Страницы · Laravilt
Custom Notifications
Build reusable notifications and send Laravilt notifications from your own Laravel notification classes.
Reusable builders
Laravilt\Notifications\Notification has a final constructor. Use it through make() or the status constructors, and wrap your common notifications in a small factory class:
php
Using Laravel's notify()
sendToDatabase() is shorthand for $user->notify(new DatabaseNotification($notification)). You can call it directly, for example to add delay or queue options:
php
Your own Laravel notification class
To send through several channels (for example mail and database), write a normal Laravel notification. Store the array produced by DatabaseNotification so the notification center can render it:
php