ResetPasswordNotification   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 59
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A toMail() 0 10 1
A __construct() 0 3 1
A toArray() 0 3 1
A via() 0 3 1
1
<?php
2
3
namespace Slides\Connector\Auth\Notifications;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Notifications\Notification;
7
use Illuminate\Notifications\Messages\MailMessage;
8
9
class ResetPasswordNotification extends Notification
10
{
11
    use Queueable;
12
13
    /**
14
     * @var string
15
     */
16
    protected $token;
17
18
    /**
19
     * Create a new notification instance.
20
     *
21
     * @param string $token
22
     *
23
     * @return void
24
     */
25
    public function __construct(string $token)
26
    {
27
        $this->token = $token;
28
    }
29
30
    /**
31
     * Get the notification's delivery channels.
32
     *
33
     * @param  mixed  $notifiable
34
     * @return array
35
     */
36
    public function via($notifiable)
37
    {
38
        return ['mail'];
39
    }
40
41
    /**
42
     * Build the mail representation of the notification.
43
     *
44
     * @param  \Illuminate\Contracts\Auth\CanResetPassword  $notifiable
45
     * @return \Illuminate\Notifications\Messages\MailMessage
46
     */
47
    public function toMail($notifiable)
48
    {
49
        $email = encrypt($notifiable->getEmailForPasswordReset());
50
51
        $link = route('password.reset', ['token' => $this->token, 'email' => $email]);
52
53
        return (new MailMessage)
54
            ->line('You are receiving this email because we received a password reset request for your account.')
55
            ->action('Reset Password', $link)
56
            ->line('If you did not request a password reset, no further action is required.');
57
    }
58
59
    /**
60
     * Get the array representation of the notification.
61
     *
62
     * @param  mixed  $notifiable
63
     * @return array
64
     */
65
    public function toArray($notifiable)
66
    {
67
        return [
68
            //
69
        ];
70
    }
71
}
72