Just adding in FCM to my app and came across this issue
Target [Illuminate\Contracts\Notifications\Dispatcher] is not instantiable while building [App\Console\Commands\TestPushNotification].
I checked the repo for various issues to see if anyone came across it and I couldn't, however took the advice here and used the SDK you use under the hood and that worked, so I know the account credentials are being picked up and the project
// This works
$messaging = app('firebase.messaging');
$message = CloudMessage::withTarget('token', $fcm)
->withNotification(Notification::create('Test', 'test')) // optional
;
$messaging->send($message);
However I cannot get it working by using $user->notify()
class PushNotification extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*/
public function via($notifiable)
{
return [FcmChannel::class];
}
public function toFcm($notifiable)
{
return FcmMessage::create()
->setNotification(\NotificationChannels\Fcm\Resources\Notification::create()
->setTitle('Account Activated')
->setBody('Your account has been activated.')
->setImage('http://example.com/url-to-image-here.png'));
}
}
Do you have any ideas what is going wrong or a direction I should look to debug this more?
Hi,
Just adding in FCM to my app and came across this issue
I checked the repo for various issues to see if anyone came across it and I couldn't, however took the advice here and used the SDK you use under the hood and that worked, so I know the account credentials are being picked up and the project
However I cannot get it working by using
$user->notify()
Do you have any ideas what is going wrong or a direction I should look to debug this more?
Currently using