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

ActivateYourAccount::toMail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
c 4
b 0
f 0
dl 0
loc 11
rs 9.4285
cc 1
eloc 8
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 ActivateYourAccount 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
            ->view('anomaly.module.users::notifications.activate_your_account')
51
            ->subject(trans('anomaly.module.users::notification.activate_your_account.subject', $data))
52
            ->greeting(trans('anomaly.module.users::notification.activate_your_account.greeting', $data))
53
            ->line(trans('anomaly.module.users::notification.activate_your_account.instructions', $data))
54
            ->action(trans('anomaly.module.users::notification.activate_your_account.button', $data), $notifiable->route('activate', ['redirect' => $this->redirect]));
55
    }
56
}
57