add job to send mail to new user

This commit is contained in:
2020-08-14 23:32:44 +02:00
parent 3c35d688b7
commit 551cdc5dfc
5 changed files with 77 additions and 4 deletions

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Jobs;
use App\Mail\NewUserInvitation;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Mail;
class SendMailNewUserJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
private $user;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
Mail::to($this->user->email)->send(new NewUserInvitation($this->user));
}
}