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
14    public string $frontendBaseUrl;
15
16    public function __construct($user)
17    {
18        $this->user = $user;
19        $this->frontendBaseUrl = config('romeo.frontend-base-url');
20    }
21
22    public function via($notifiable)
23    {
24        return ['mail'];
25    }
26
27    public function toMail($notifiable): MailMessage
28    {
29        $user = $this->user;
30        // There's a global bcc in MessageSendingListener
31        try {
32            return (new MailMessage)
33                ->bcc(config('hubspotconfig.bcc_email'))
34                ->subject(Lang::get('You’re in! You’re so Fly…'))
35                ->view('mail.user.welcome', compact('user'));
36        } catch (\Exception $e) {
37            Log::error('[JONATAS] - Error sending welcome email to user: '.$user->email);
38            logger($e->getMessage());
39            throw $e;
40        }
41    }
42}