Passed
Push — feature/application-review-ui ( afbf92 )
by Chris
06:55
created

ResetPasswordNotification   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 13
c 0
b 0
f 0
dl 0
loc 55
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A toMail() 0 9 1
A via() 0 3 1
1
<?php
2
3
namespace App\Notifications;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Notifications\Notification;
7
use Illuminate\Contracts\Queue\ShouldQueue;
8
use Illuminate\Notifications\Messages\MailMessage;
9
use Illuminate\Support\Facades\Lang;
10
11
class ResetPasswordNotification extends Notification implements ShouldQueue
12
{
13
    use Queueable;
14
15
    /**
16
     * The number of times the job may be attempted.
17
     *
18
     * @var integer
19
     */
20
    public $tries = 5;
21
22
    /**
23
     * The password reset token.
24
     *
25
     * @var string
26
     */
27
    public $token;
28
29
    /**
30
     * Create a notification instance.
31
     *
32
     * @param  string  $token
33
     * @return void
34
     */
35
    public function __construct($token)
36
    {
37
        $this->token = $token;
38
    }
39
40
    /**
41
     * Get the notification's delivery channels.
42
     *
43
     * @param  mixed  $notifiable
44
     * @return array
45
     */
46
    public function via($notifiable)
47
    {
48
        return ['mail'];
49
    }
50
51
    /**
52
     * Get the mail representation of the notification.
53
     *
54
     * @param  mixed  $notifiable
55
     * @return \Illuminate\Notifications\Messages\MailMessage
56
     */
57
    public function toMail($notifiable)
58
    {
59
        return (new MailMessage)
60
            ->subject(Lang::get('common/notifications/password_reset.subject'))
61
            ->greeting(Lang::get('common/notifications/password_reset.greeting'))
62
            ->line(Lang::get('common/notifications/password_reset.line_1'))
63
            ->action(Lang::get('common/notifications/password_reset.action'), url(route('password.reset', $this->token, false)))
0 ignored issues
show
Bug introduced by
The function route was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

63
            ->action(Lang::get('common/notifications/password_reset.action'), url(/** @scrutinizer ignore-call */ route('password.reset', $this->token, false)))
Loading history...
Bug introduced by
The function url was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

63
            ->action(Lang::get('common/notifications/password_reset.action'), /** @scrutinizer ignore-call */ url(route('password.reset', $this->token, false)))
Loading history...
64
            ->line(Lang::get('common/notifications/password_reset.line_2'))
65
            ->salutation(Lang::get('common/notifications/password_reset.salutation', ['name' => config('mail.from.name')]));
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

65
            ->salutation(Lang::get('common/notifications/password_reset.salutation', ['name' => /** @scrutinizer ignore-call */ config('mail.from.name')]));
Loading history...
66
    }
67
}
68