laravel-notification-channels/webpush

Call to a member function isEmpty() null

Rakesh2907 opened this issue · 3 comments

Hello,

When set Notification::send(User::all(),new PushDemo); in my controller getting following error

Call to a member function isEmpty() on null at D:\xampp\htdocs\XXXXXX\vendor\laravel-notification-channels\webpush\src\WebPushChannel.php:44)

Please help me.

Came across the same error. Adding the HasPushSubscriptions using on my user model fixed it for me
class User extends Authenticatable implements JWTSubject { use HasFactory, Notifiable, HasPushSubscriptions;

I'm curious how to do this when your subscribers don't have user models. Ie. They've subscribed via the browser notice, but don't have a user account.

I have same error .
How to solve this problem?