Complete the code to create a new notification class using Artisan.
php artisan [1] NotificationNameUse make:notification to create a new notification class in Laravel.
Complete the code to send a notification to a user instance.
$user->[1](new InvoicePaidNotification($invoice));The notify method sends a notification to the user instance.
Fix the error in the notification class to specify the delivery channels.
public function [1](mixed $notifiable): array { return ['mail', 'database']; }
The via method defines which channels the notification will use.
Fill both blanks to return the mail message with a subject and greeting.
public function toMail(mixed $notifiable): MailMessage
{
return (new MailMessage)
->subject([1])
->greeting([2]);
}The subject sets the email subject, and greeting sets the opening line.
Fill all three blanks to create a database notification array with an invoice id, amount, and status.
public function toDatabase(mixed $notifiable): array
{
return [
'invoice_id' => [1],
'amount' => [2],
'status' => [3]
];
}The database notification stores invoice id and amount from the invoice object, and the status as 'paid'.
