F
Filamentβ€’2y ago
Yatendra

database notification not working

where i use @livewire('database-notifications')
Solution:
try this ```php Notification::make() ->title('Saved successfully')...
Jump to solution
25 Replies
LeandroFerreira
LeandroFerreiraβ€’2y ago
are you using the panel builder or only the notifications package?
Yatendra
YatendraOPβ€’2y ago
yes panel builder and i add ->databaseNotifications() in admin panel but no notification is showing on alert icon but i have entry in notification table
LeandroFerreira
LeandroFerreiraβ€’2y ago
I mean
# Laravel 11 and higher
php artisan make:notifications-table

# Laravel 10
php artisan notifications:table
# Laravel 11 and higher
php artisan make:notifications-table

# Laravel 10
php artisan notifications:table
Yatendra
YatendraOPβ€’2y ago
yes, but I not know where i can use @livewire('database-notifications') because i have no blade
LeandroFerreira
LeandroFerreiraβ€’2y ago
this is required if you are using the notifications outside the panel builder
Yatendra
YatendraOPβ€’2y ago
yes I have been check for laravel11 and laravel 10 but not working
LeandroFerreira
LeandroFerreiraβ€’2y ago
did you test the notification?
use Filament\Notifications\Notification;

$recipient = auth()->user();

Notification::make()
->title('Saved successfully')
->sendToDatabase($recipient);
use Filament\Notifications\Notification;

$recipient = auth()->user();

Notification::make()
->title('Saved successfully')
->sendToDatabase($recipient);
did you do this: php artisan queue:work
Yatendra
YatendraOPβ€’2y ago
yes i am using like use Filament\Notifications\Notification; $recipient = auth()->user(); Notification::make() ->title('Saved successfully') ->sendToDatabase($recipient); and I also try php artisan queue:work but not working
LeandroFerreira
LeandroFerreiraβ€’2y ago
Is there a notification in the notifications_table?
Yatendra
YatendraOPβ€’2y ago
yes I have notifcation in notifications table
LeandroFerreira
LeandroFerreiraβ€’2y ago
did you refresh the page?
Yatendra
YatendraOPβ€’2y ago
yes
LeandroFerreira
LeandroFerreiraβ€’2y ago
can you send a screenshot please?
Yatendra
YatendraOPβ€’2y ago
ok
No description
Yatendra
YatendraOPβ€’2y ago
No description
LeandroFerreira
LeandroFerreiraβ€’2y ago
did you add Notifiable trait in the User model?
Yatendra
YatendraOPβ€’2y ago
yes did
Solution
LeandroFerreira
LeandroFerreiraβ€’2y ago
try this
Notification::make()
->title('Saved successfully')
->sendToDatabase(auth()->user());
Notification::make()
->title('Saved successfully')
->sendToDatabase(auth()->user());
LeandroFerreira
LeandroFerreiraβ€’2y ago
notifiable_type should be App\Models\User
Yatendra
YatendraOPβ€’2y ago
yes working Thanks, but how i can use for export excel notification
Yatendra
YatendraOPβ€’2y ago
ok I try
LeandroFerreira
LeandroFerreiraβ€’2y ago
database notification is working πŸ‘
Yatendra
YatendraOPβ€’2y ago
πŸ‘ Thank you so much

Did you find this page helpful?