laravel-notification-channels/webpush

Push without user

bilogic opened this issue · 1 comments

As I understand it, the web push standard only requires the endpoint as an identifier, so it seems a bit restrictive that a user account is required in order to push.

Would be great if we can push without $user by allowing subscribable_type and subscribable_id to be nullable.
Of course, more code would be required to push directly.

Thank you.

Hi, I solved this issue by using firstOrFail()
$notif = Notif::where('id', 2)->firstOrFail();
$notif->updatePushSubscription($endpoint, $key, $token);