Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Filament Notification (WIP)

Notification feed for Filament with actions support

Installation

You can install the package via composer:

composer require webbingbrasil/filament-notification

Add notification feed icon

Use render-hooks to register notification feed component after global search

Filament::registerRenderHook(
    'global-search.end',
    fn (): string => Blade::render('@livewire(\'filament-notification.feed\')'),
);

Configure notification

All database notification are displayed in feed, so you will need to configure via() to use database provider and message in toArray() or toDatabase() methods.

<?php

namespace App\Notifications;

use Illuminate\Notifications\Notification;
use Webbingbrasil\FilamentNotification\Notifications\NotificationLevel;

class UserNotification extends Notification
{

    public function via($notifiable)
    {
        return [
            'database'
        ];
    }

    public function toArray($notifiable)
    {
        return [
            'level' => NotificationLevel::INFO, 
            'title' => 'Info notification', 
            'message' => 'Lorem ipsum'
        ];
    }
}

Notification actions

You can add actions to any notification displayed in feed using notificationFeedActions() method:

<?php

namespace App\Notifications;

use Illuminate\Notifications\Notification;
use Webbingbrasil\FilamentNotification\Actions\ButtonAction;

class UserNotification extends Notification
{
    static public function notificationFeedActions()
    {
        return [
            ButtonAction::make('markRead')->icon('heroicon-o-check')
                ->label('Mark as read')
                ->hidden(fn($record) => $record->read()) // Use $record to access/update notification, this is DatabaseNotification model
                ->action(function ($record, $livewire) {
                    $record->markAsRead();
                    $livewire->refresh(); // $livewire can be used to refresh ou reset notification feed
                })
                ->outlined()
                ->color('secondary'),
            ButtonAction::make('profile')
                ->label('Complete Profile')
                ->hidden(fn($record) => $record->read())
                ->icon('heroicon-o-user')
                ->action(function ($record, $livewire, $data) {
                    $record->markAsRead();
                    $livewire->refresh();
                    Auth::user()->update($data);
                })
                ->form([
                    DatePicker::make('birthday')
                        ->label('Birthday')
                        ->required(),
                ])
                ->modalHeading('Complete Profile')
                ->modalSubheading('Complete you profile information')
                ->modalButton('Save')
                ->outlined()
                ->color('secondary'),
        ];
    }
}

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Notification feed plugin for filament

Resources

Stars

17 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages