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
25    public string $frontendBaseUrl;
26
27    /**
28     * Create a new notification instance.
29     *
30     * @return void
31     */
32    public function __construct($data_array = [])
33    {
34        $this->invitation_id = $data_array['invitation_id'];
35        $this->first_name = $data_array['first_name'];
36        $this->last_name = $data_array['last_name'];
37        $this->email = $data_array['email'];
38        $this->personal_message = $data_array['personal_message'];
39        $this->referral_key = $data_array['referral_key'];
40        $this->frontendBaseUrl = config('romeo.frontend-base-url');
41    }
42
43    /**
44     * Get the notification's delivery channels.
45     *
46     * @param  mixed  $notifiable
47     */
48    public function via($notifiable): array
49    {
50        return ['mail'];
51    }
52
53    /**
54     * Route notifications for the mail channel.
55     *
56     * @return array|string
57     */
58    public function routeNotificationForMail(Notification $notification)
59    {
60        return [$this->email];
61    }
62
63    /**
64     * Get the mail representation of the notification.
65     *
66     * @param  mixed  $notifiable
67     */
68    public function toMail($notifiable): MailMessage
69    {
70        $invitation_url = 'https://app.vengreso.com/session/signup?referel='.$this->referral_key;
71
72        return (new MailMessage)
73            ->bcc(config('hubspotconfig.bcc_email'))
74            ->subject('Invitation for flymsg')
75            ->view('mail.user.invitation_email', [
76                'invitation_url' => $invitation_url,
77                'first_name' => $this->first_name,
78                'last_name' => $this->last_name,
79                'personal_message' => $this->personal_message,
80            ]);
81    }
82
83    /**
84     * Get the array representation of the notification.
85     *
86     * @param  mixed  $notifiable
87     */
88    public function toArray($notifiable): array
89    {
90        return [
91            //
92        ];
93    }
94}