Complete the code to send a mail notification using Laravel's Notification system.
Notification::route('mail', 'user@example.com')->[1](new InvoicePaid($invoice));
The notify method is used to send notifications to the specified channel in Laravel.
Complete the code to define the database notification channel in the notification class.
public function via($notifiable)
{
return ['[1]'];
}The database channel stores notifications in the database for later retrieval.
Fix the error in the SMS notification method to return the correct message format.
public function toSms($notifiable)
{
return (new SmsMessage)
->content('[1]');
}The content method expects a plain string argument.
Fill both blanks to create a database notification with a custom data array.
public function toArray($notifiable)
{
return [
'[1]' => $this->invoice->id,
'[2]' => $this->invoice->amount,
];
}The keys invoice_id and amount clearly represent the invoice's ID and amount in the data array.
Fill all three blanks to send a notification via mail, database, and SMS channels.
public function via($notifiable)
{
return ['[1]', '[2]', '[3]'];
}To send notifications via mail, database, and SMS, include all three channel names in the array.