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
LeandroFerreira7mo ago
are you using the panel builder or only the notifications package?
Yatendra
Yatendra7mo 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
LeandroFerreira7mo 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
Yatendra7mo ago
yes, but I not know where i can use @livewire('database-notifications') because i have no blade
LeandroFerreira
LeandroFerreira7mo ago
this is required if you are using the notifications outside the panel builder
Yatendra
Yatendra7mo ago
yes I have been check for laravel11 and laravel 10 but not working
LeandroFerreira
LeandroFerreira7mo 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
Yatendra7mo 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
LeandroFerreira7mo ago
Is there a notification in the notifications_table?
Yatendra
Yatendra7mo ago
yes I have notifcation in notifications table
LeandroFerreira
LeandroFerreira7mo ago
did you refresh the page?
Yatendra
Yatendra7mo ago
yes
LeandroFerreira
LeandroFerreira7mo ago
can you send a screenshot please?
Yatendra
Yatendra7mo ago
ok
No description
Yatendra
Yatendra7mo ago
No description
LeandroFerreira
LeandroFerreira7mo ago
did you add Notifiable trait in the User model?
Yatendra
Yatendra7mo ago
yes did
Solution
LeandroFerreira
LeandroFerreira7mo ago
try this
Notification::make()
->title('Saved successfully')
->sendToDatabase(auth()->user());
Notification::make()
->title('Saved successfully')
->sendToDatabase(auth()->user());
LeandroFerreira
LeandroFerreira7mo ago
notifiable_type should be App\Models\User
Yatendra
Yatendra7mo ago
yes working Thanks, but how i can use for export excel notification
Yatendra
Yatendra7mo ago
ok I try
LeandroFerreira
LeandroFerreira7mo ago
database notification is working 👍
Yatendra
Yatendra7mo ago
👍 Thank you so much
Want results from more Discord servers?
Add your server