Complete the code to create a new mailable class using Artisan.
php artisan make:[1] WelcomeEmailUse make:mailable to generate a new mailable class in Laravel.
Complete the code to send the mailable class named WelcomeEmail to a user.
Mail::to($user->email)->[1](new WelcomeEmail());The send method sends the email immediately.
Fix the error in the build method to return the email view named 'emails.welcome'.
public function build()
{
return $this->[1]('emails.welcome');
}The build method must return $this->view('view.name') to set the email template.
Fill both blanks to pass data to the email view in the build method.
public function build()
{
return $this->view('emails.notification')->with([1] => [2]);
}Use with('key' => value) to pass data to the view. Here, 'userName' is the key and $this->userName is the value.
Fill all three blanks to define a constructor that accepts a User object and assigns it to a class property.
public function __construct([1] $user) { $this->[2] = [3]; }
The constructor receives a User object named $user and assigns it to the property $this->user.