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

AccountCreated   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Test Coverage

Coverage 94.44%

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 58
ccs 17
cts 18
cp 0.9444
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A via() 0 3 1
A __construct() 0 3 1
A toMail() 0 14 2
A toArray() 0 3 1
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