PHP code example of benriadh1 / filament-notification-bell
1. Go to this page and download the library: Download benriadh1/filament-notification-bell library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
benriadh1 / filament-notification-bell example snippets
use Benriadh1\FilamentNotificationBell\FilamentNotificationBellPlugin;
public function panel(Panel $panel): Panel
{
return $panel
// ... your other panel config
->plugin(FilamentNotificationBellPlugin::make());
}
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\DatabaseMessage;
class OrderShipped extends Notification
{
public function via($notifiable): array
{
return ['database'];
}
public function toDatabase($notifiable): array
{
return [
'title' => 'Order Shipped',
'body' => 'Your order #1234 has been shipped.',
'url' => route('orders.show', 1234),
'type' => 'success', // 'info' | 'success' | 'warning' | 'error'
];
}
}
$user->notify(new OrderShipped());
use Benriadh1\FilamentNotificationBell\Concerns\HasNotificationBell;
class User extends Authenticatable
{
use HasNotificationBell;
}
$user->notify(new OrderShipped());
$user->notifyBell(); // broadcasts the NotificationSent event via Reverb
FilamentNotificationBellPlugin::make()
->limit(30)
->slideOver() // or ->dropdown() (default)
->withPolling(60) // enable polling every 60 seconds
->locale('fr') // force French locale
->rtl() // force RTL layout
->lightMode() // or ->darkMode() or ->autoTheme() (default)
->usePusher() // or ->useReverb() (default)
// In config/filament-notification-bell.php
'rtl_locales' => ['ar', 'fa', 'he', 'ur', 'ug'],
// Or via fluent plugin API
FilamentNotificationBellPlugin::make()->rtl()