PasswordReset   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 44
rs 10
c 0
b 0
f 0

2 Methods

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