Passed
Pull Request — master (#53)
by
unknown
05:24
created

AccountCreated::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Notifications;
4
5
use App\User;
6
use Illuminate\Bus\Queueable;
7
use Illuminate\Notifications\Messages\MailMessage;
8
use Illuminate\Notifications\Notification;
9
10
class AccountCreated extends Notification
11
{
12
    use Queueable;
13
14
    protected $user;
15
16
    /**
17
     * AccountCreated constructor.
18
     * @param User $user
19
     */
20 1
    public function __construct(User $user)
21
    {
22 1
        $this->user = $user;
23 1
    }
24
25
26
    /**
27
     * Get the notification's delivery channels.
28
     *
29
     * @param  mixed $notifiable
30
     * @return array
31
     */
32 1
    public function via($notifiable)
33
    {
34 1
        return ['mail'];
35
    }
36
37
    /**
38
     * Get the mail representation of the notification.
39
     *
40
     * @param  mixed $notifiable
41
     * @return \Illuminate\Notifications\Messages\MailMessage
42
     */
43 1
    public function toMail($notifiable)
44
    {
45 1
        $appName = (app()->environment() == 'local' ? getenv('APP_NAME') : config('app.name'));
46 1
        $subject = trans('mail.activation_account') . " " . $appName;
47
48 1
        return (new MailMessage)
49 1
            ->subject($subject)
50 1
            ->greeting(trans('mail.dear_kenshi'))
51 1
            ->line(trans('mail.user_invited_you', [
52 1
                'user' => $this->user->name,
53 1
                'appName' => $appName]))
54 1
            ->line(trans('mail.please_click_link_to_confirm_account'))
55 1
            ->action(trans('mail.activate_account'), url("/register/confirm/{$this->user->token}"))
56 1
            ->line(trans('mail.tx_for_signup'));
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