Passed
Push — dev ( 9d591d...c59ba0 )
by Darko
22:01
created

SendPasswordResetEmail::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Jobs;
4
5
use App\Mail\PasswordReset;
6
use Illuminate\Bus\Queueable;
7
use Illuminate\Contracts\Queue\ShouldQueue;
8
use Illuminate\Foundation\Bus\Dispatchable;
9
use Illuminate\Queue\InteractsWithQueue;
10
use Illuminate\Queue\SerializesModels;
11
use Illuminate\Support\Facades\Mail;
12
13
class SendPasswordResetEmail implements ShouldQueue
14
{
15
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by App\Jobs\SendPasswordResetEmail: $id, $relations, $class, $keyBy
Loading history...
16
17
    /**
18
     * @var \App\Models\User
19
     */
20
    private $user;
21
22
    /**
23
     * @var string
24
     */
25
    private $newPass;
26
27
    /**
28
     * Create a new job instance.
29
     *
30
     * @param \App\Models\User $user
31
     * @param string $newPass
32
     */
33
    public function __construct($user, $newPass)
34
    {
35
        $this->user = $user;
36
        $this->newPass = $newPass;
37
    }
38
39
    /**
40
     * Execute the job.
41
     *
42
     * @return void
43
     */
44
    public function handle()
45
    {
46
        Mail::to($this->user->email)->send(new PasswordReset($this->user, $this->newPass));
47
    }
48
}
49