🔴 Laravel Intermediate

What is the Notification system in Laravel?

Why Interviewers Ask This

Candidates at the intermediate level are expected to not only know this concept but explain the trade-offs involved. Interviewers use this question to see if you can reason about design decisions, not just recall facts.

Answer

Notifications provide a unified API for sending notifications via multiple channels (email, SMS, Slack, database, push) from a single class. Generate: php artisan make:notification InvoicePaid. Specify channels in via(): return ["mail", "database", "slack"]. Define each channel's content: toMail(), toDatabase(), toSlack(). Send to a user: $user->notify(new InvoicePaid($invoice)) (requires Notifiable trait). Send to multiple via Notification facade: Notification::send($users, new InvoicePaid($invoice)). Database notifications are stored in a notifications table and can be retrieved: $user->notifications, $user->unreadNotifications. Queue notifications by implementing ShouldQueue.

Pro Tip

Before answering, structure your response: one-line definition → real-world analogy → concrete example from a project. This makes even complex Laravel answers easy to follow.