Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
Welcome
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 3
20
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
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
 toMail
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace App\Notifications\User;
4
5use Illuminate\Notifications\Messages\MailMessage;
6use Illuminate\Notifications\Notification;
7use Illuminate\Support\Facades\Lang;
8use Illuminate\Support\Facades\Log;
9
10class Welcome extends Notification
11{
12    public $user;
13    public string $frontendBaseUrl;
14
15    public function __construct($user)
16    {
17        $this->user = $user;
18        $this->frontendBaseUrl = config('romeo.frontend-base-url');
19    }
20
21    public function via($notifiable)
22    {
23        return ['mail'];
24    }
25
26    public function toMail($notifiable): MailMessage
27    {
28        $user = $this->user;
29        //There's a global bcc in MessageSendingListener
30        try {
31            return (new MailMessage)
32            ->bcc(config('hubspotconfig.bcc_email'))
33            ->subject(Lang::get('You’re in! You’re so Fly…'))
34            ->view('mail.user.welcome', compact('user'));
35        } catch (\Exception $e) {
36            Log::error('[JONATAS] - Error sending welcome email to user: ' . $user->email);
37            logger($e->getMessage());
38            throw $e;
39        }
40    }
41}