/
SendPasswordResetEmail.php
53 lines (48 loc) · 1.1 KB
/
SendPasswordResetEmail.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php namespace App\Jobs;
use App\Models\User;
use Illuminate\Contracts\Mail\Mailer;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Contracts\Queue\ShouldQueue;
class SendPasswordResetEmail extends Job implements SelfHandling, ShouldQueue
{
/**
* User to email.
*
* @var \App\Models\User
*/
protected $user;
/**
* Token for confirmation.
*
* @var string
*/
protected $token;
/**
* Create a new job instance.
*
* @param User $user
* @param string $token
* @return void
*/
public function __construct(User $user, $token)
{
$this->user = $user;
$this->token = $token;
}
/**
* Execute the job.
*
* @param Mailer $mailer
* @return void
*/
public function handle(Mailer $mailer)
{
$mailer->send('emails.resetPassword', [
'user' => $this->user,
'token' => $this->token
], function ($m) {
$m->to($this->user->email, $this->user->full_name)
->subject('Password Reset');
});
}
}