PasswordReset::build()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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