notify() method on a user model, what happens behind the scenes to ensure the user receives the notification?User::find(1)->notify(new InvoicePaid($invoice));Laravel notifications use channels like mail, database, SMS, or broadcast. When you call notify(), Laravel queues the notification and sends it asynchronously through the channels defined in the notification class.
read_at column for that notification?$notification = $user->notifications()->first(); $readAtBefore = $notification->read_at; $notification->markAsRead(); $readAtAfter = $notification->fresh()->read_at;
When a notification is first created, read_at is null. Calling markAsRead() sets read_at to the current timestamp, indicating the notification was read.
class InvoicePaid extends Notification { public function via($notifiable) { // Which option is correct? } }
The via method must accept the $notifiable parameter and return an array of channels like ['mail', 'database']. Option D is the correct syntax.
User::find(1)->notify(new InvoicePaid($invoice)); // Notification class uses 'mail' and 'database' channels // Mail configuration is set but emails do not arrive
If the mail driver is set to 'log' or 'array', Laravel writes emails to logs or memory but does not send them. This causes notifications to be stored but no emails sent.
Laravel's notification system supports multiple delivery channels and uses queues to send notifications asynchronously. This design improves reliability and user reach by retrying and handling failures gracefully.