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

SendPasswordResetEmail   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 7
c 0
b 0
f 0
dl 0
loc 34
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 3 1
A __construct() 0 4 1
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