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)

FilamentNotificationBellPlugin::make()->lightMode()

FilamentNotificationBellPlugin::make()->darkMode()

FilamentNotificationBellPlugin::make()->autoTheme()

return [
    'title' => 'My Custom Title',
    // ...
];

// resources/lang/vendor/filament-notification-bell/it/notification-bell.php
return [
    'title'            => 'Notification',
    'mark_all_read'    => '',
    // ... all keys
];

FilamentNotificationBellPlugin::make()->locale('fr')

// In config/filament-notification-bell.php
'rtl_locales' => ['ar', 'fa', 'he', 'ur', 'ug'],

// Or via fluent plugin API
FilamentNotificationBellPlugin::make()->rtl()
bash
php artisan vendor:publish --tag="filament-notification-bell-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="filament-notification-bell-assets"
bash
php artisan vendor:publish --tag="filament-notification-bell-config"
bash
php artisan vendor:publish --tag="filament-notification-bell-views"
bash
php artisan vendor:publish --tag="filament-notification-bell-lang"

resources/lang/vendor/filament-notification-bell/{locale}/notification-bell.php