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

PasswordReset::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 6
ccs 0
cts 1
cp 0
rs 10
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
namespace App\Mail;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Mail\Mailable;
7
use Illuminate\Queue\SerializesModels;
8
9
class PasswordReset extends Mailable
10
{
11
    use Queueable, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by App\Mail\PasswordReset: $id, $relations, $class, $keyBy
Loading history...
12
13
    /**
14
     * @var \App\Models\User
15
     */
16
    private $user;
17
18
    /**
19
     * @var string
20
     */
21
    private $newPass;
22
23
    /**
24
     * @var mixed
25
     */
26
    private $siteEmail;
27
28
    /**
29
     * @var mixed
30
     */
31
    private $siteTitle;
32
33
    /**
34
     * PasswordReset constructor.
35
     *
36
     * @param \App\Models\User $user
37
     * @param                  $newPass
38
     */
39
    public function __construct($user, $newPass)
40
    {
41
        $this->user = $user;
42
        $this->newPass = $newPass;
43
        $this->siteEmail = config('mail.from.address');
44
        $this->siteTitle = config('app.name');
45
    }
46
47
    /**
48
     * Build the message.
49
     *
50
     * @return $this
51
     * @throws \Exception
52
     */
53
    public function build()
54
    {
55
        return $this->from($this->siteEmail)->subject('Password reset')->view('emails.passwordReset')->with(['newPass' => $this->newPass, 'userName' => $this->user->username, 'site' => $this->siteTitle]);
56
    }
57
}
58