Normally when sending notifications in Laravel you send to a class with a Notifiable
trait that defines "who" the notification is going to by the instance of the class. Such as with the User model.
I have a use case to send a notification to myself (the admin) and I don't have an entry in the User model.
Laravel does allow the use of the route()
method using the Notification facade such as
Notification::route('email', 'admin@myapp.example')->notify(new SomeLaravelNotification());
However imo that's kinda verbose, is there a way to wrap the routing logic into the Notification class so I can just call something like
Notification::send(new SomeLaravelNotification());
Then I could have the routing logic as part of the SomeLaravelNotification
class?