[solved] Notifications in packages

Is here anybody who did any package with notification?

I make one, and the notification correctly sent form the package, but if I pass variable to the notification class, my app crashes with BindingResolutionException error:

Unresolvable dependency resolving [Parameter #0 [ <required> $user ]] in class Vendor\Package\Notifications\NotificationNameNotification

This is how I initialise the notification class in the package service provider register function:


svolenszki replied 1 year ago

For those, who face with the same problem:

The IoC can not resolve the model form the package, so must defined in the notification class like this:

public function __construct(App\User $user) { $this->user = $user; }

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us