Is there a way to send Database notifications from Job?

I read about Broadcast notifications and that they can be used to send notifications from job, but I was wondering if there is a way to accomplish that without Broadcast notifications? Like with Database notifications that get fetched?
5 Replies
toeknee
toeknee17mo ago
->sendToDatabase() ? Just call the notification class no?
StanProg
StanProgOP17mo ago
No, the notification is added to the database, but not displayed, unless I refresh the page. I waited for a way more than the polling time, but so far it appears only if I refresh the page.
toeknee
toeknee17mo ago
It will show again if the notifications are polling but it’s not instant like a push, you need another method for refreshing the. Notifications on a webhook type request I believe for that
StanProg
StanProgOP17mo ago
In the config I have:
'database' => [
'enabled' => true,
'trigger' => 'notifications.database-notifications-trigger',
'polling_interval' => '60s',
],
'database' => [
'enabled' => true,
'trigger' => 'notifications.database-notifications-trigger',
'polling_interval' => '60s',
],
But I noticed that they appear in like 30-50 minutes, not seconds. Maybe be I've misconfigured something, or did not set something that I should have. The problem is that we don't want to setup a server for Laravel Echo/Pusher.
toeknee
toeknee17mo ago
No that lookss good Try reducing it down to 5s and purge cache and monitor the brower for the network requests

Did you find this page helpful?