Notifications

Database

A bell in the top bar that shows notifications stored in the database.

$panel->databaseNotifications();
The notifications open under the bellThe notifications open under the bell

This adds a bell to the top bar, which checks every 30 seconds. It needs Laravel's table, from php artisan make:notifications-table, and Notifiable on your user model.

use Xelqun\Panels\Notifications\DatabaseNotification;

DatabaseNotification::make()
    ->title('Order paid')
    ->body('Order 1001 is ready to ship.')
    ->success()
    ->url(OrderResource::getUrl('view', ['record' => $order]))
    ->sendToDatabase($user);

databaseNotificationsPolling() changes how often it checks, and null checks only on page load.

$panel->databaseNotificationsPolling('60s');

Try it in the demo: press "Send me a notification".