Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 22
0.00% covered (danger)
0.00%
0 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
InvitationEmail
0.00% covered (danger)
0.00%
0 / 22
0.00% covered (danger)
0.00%
0 / 5
30
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
 via
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 routeNotificationForMail
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 toMail
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 1
2
 toArray
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Notifications\User;
4
5use Illuminate\Bus\Queueable;
6use Illuminate\Notifications\Messages\MailMessage;
7use Illuminate\Notifications\Notification;
8
9class InvitationEmail extends Notification
10{
11    use Queueable;
12
13    protected $invitation_id;
14
15    protected $first_name;
16
17    protected $last_name;
18
19    protected $email;
20
21    protected $personal_message;
22
23    protected $referral_key;
24    public string $frontendBaseUrl;
25
26    /**
27     * Create a new notification instance.
28     *
29     * @return void
30     */
31    public function __construct($data_array = [])
32    {
33        $this->invitation_id = $data_array['invitation_id'];
34        $this->first_name = $data_array['first_name'];
35        $this->last_name = $data_array['last_name'];
36        $this->email = $data_array['email'];
37        $this->personal_message = $data_array['personal_message'];
38        $this->referral_key = $data_array['referral_key'];
39        $this->frontendBaseUrl = config('romeo.frontend-base-url');
40    }
41
42    /**
43     * Get the notification's delivery channels.
44     *
45     * @param  mixed  $notifiable
46     */
47    public function via($notifiable): array
48    {
49        return ['mail'];
50    }
51
52    /**
53     * Route notifications for the mail channel.
54     *
55     * @return array|string
56     */
57    public function routeNotificationForMail(Notification $notification)
58    {
59        return [$this->email];
60    }
61
62    /**
63     * Get the mail representation of the notification.
64     *
65     * @param  mixed  $notifiable
66     */
67    public function toMail($notifiable): MailMessage
68    {
69        $invitation_url = env('FRONTEND_BASE_URL').'/session/signup?referel='.$this->referral_key;
70
71        return (new MailMessage)
72            ->bcc(config('hubspotconfig.bcc_email'))
73            ->subject('Invitation for flymsg')
74            ->view('mail.user.invitation_email', [
75                'invitation_url' => $invitation_url,
76                'first_name' => $this->first_name,
77                'last_name' => $this->last_name,
78                'personal_message' => $this->personal_message,
79            ]);
80    }
81
82    /**
83     * Get the array representation of the notification.
84     *
85     * @param  mixed  $notifiable
86     */
87    public function toArray($notifiable): array
88    {
89        return [
90            //
91        ];
92    }
93}