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