journal-intime/app/Jobs/SendWelcomeEmail.php

41 lines
839 B
PHP
Raw Permalink Normal View History

2019-09-25 15:25:22 +02:00
<?php
namespace App\Jobs;
use App\Mail\WelcomeMail;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Facades\Mail;
class SendWelcomeEmail implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
private $user;
/**
* Create a new job instance.
*
* @param \App\User $user
*/
public function __construct(User $user)
{
$this->user = $user;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
Mail::to($this->user->getEmailForVerification())
->queue(new WelcomeMail($this->user));
}
}