Completed
Push — master ( f06f41...6c4f3d )
by Ryan
02:40
created

ResetYourPassword::toMail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 14
rs 9.4285
cc 1
eloc 11
nc 1
nop 1
1
<?php namespace Anomaly\UsersModule\User\Notification;
2
3
use Illuminate\Notifications\Notifiable;
4
use Illuminate\Notifications\Notification;
5
use Illuminate\Notifications\Messages\SlackMessage;
6
use Anomaly\UsersModule\User\Contract\UserInterface;
7
use Anomaly\Streams\Platform\Notification\Message\MailMessage;
8
9
class ResetYourPassword extends Notification
10
{
11
    /**
12
     * Redirect here after activating.
13
     *
14
     * @var string
15
     */
16
    public $redirect;
17
18
    /**
19
     * Create a new UserHasRegistered instance.
20
     *
21
     * @param $redirect
22
     */
23
    public function __construct($redirect = '/')
24
    {
25
        $this->redirect = $redirect;
26
    }
27
28
    /**
29
     * Get the notification's delivery channels.
30
     *
31
     * @param  UserInterface $notifiable
32
     * @return array
33
     */
34
    public function via(UserInterface $notifiable)
35
    {
36
        return ['mail'];
37
    }
38
39
    /**
40
     * Return the mail message.
41
     *
42
     * @param  UserInterface $notifiable
43
     * @return MailMessage
44
     */
45
    public function toMail(UserInterface $notifiable)
46
    {
47
        $data = $notifiable->toArray();
48
49
        return (new MailMessage())
50
            ->error()
51
            ->view('anomaly.module.users::notifications.reset_your_password')
52
            ->subject(trans('anomaly.module.users::notification.reset_your_password.subject', $data))
53
            ->greeting(trans('anomaly.module.users::notification.reset_your_password.greeting', $data))
54
            ->line(trans('anomaly.module.users::notification.reset_your_password.notice', $data))
55
            ->line(trans('anomaly.module.users::notification.reset_your_password.warning', $data))
56
            ->line(trans('anomaly.module.users::notification.reset_your_password.instructions', $data))
57
            ->action(trans('anomaly.module.users::notification.reset_your_password.button', $data), $notifiable->route('reset', ['redirect' => $this->redirect]));
58
    }
59
}
60