Interview frequency: …
Short answer
They send a unified notification through multiple channels (mail, database, sms, broadcast) selected by via(), and can be tested with Notification::fake().
Explanation
Instead of writing separate code to send email, store a database notification, and send SMS, the Notification class uses via($notifiable) to select active channels. In tests, Notification::fake() verifies that the notification was sent to the intended user with the right data without sending real external messages.
Code example
Notification::fake();
$user->notify(new InvoicePaid($invoice));
Notification::assertSentTo($user, InvoicePaid::class);Common mistakes
- Not implementing ShouldQueue on notifications sent through slow network channels such as Mail or Twilio.