Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| FlyCutSharedMail | |
0.00% |
0 / 14 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
2 | |||
| build | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| baseUrl | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| pathUrl | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| isProd | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Mail; |
| 4 | |
| 5 | use Illuminate\Bus\Queueable; |
| 6 | use Illuminate\Contracts\Queue\ShouldQueue; |
| 7 | use Illuminate\Mail\Mailable; |
| 8 | use Illuminate\Queue\SerializesModels; |
| 9 | |
| 10 | class FlyCutSharedMail extends Mailable implements ShouldQueue |
| 11 | { |
| 12 | use Queueable, SerializesModels; |
| 13 | |
| 14 | /** |
| 15 | * @var string |
| 16 | */ |
| 17 | public $flyshareToken; |
| 18 | |
| 19 | /** |
| 20 | * @var string |
| 21 | */ |
| 22 | public $firstName; |
| 23 | |
| 24 | /** |
| 25 | * @var string |
| 26 | */ |
| 27 | public $lastName; |
| 28 | |
| 29 | /** |
| 30 | * @var string |
| 31 | */ |
| 32 | public $personalMessage; |
| 33 | |
| 34 | /** |
| 35 | * @var string |
| 36 | */ |
| 37 | public $shortcutPreview; |
| 38 | |
| 39 | /** |
| 40 | * @var int |
| 41 | */ |
| 42 | public $flymsgCount; |
| 43 | |
| 44 | /** |
| 45 | * @var string |
| 46 | */ |
| 47 | public $baseUrl; |
| 48 | |
| 49 | /** |
| 50 | * @var string |
| 51 | */ |
| 52 | public $inviteLink; |
| 53 | |
| 54 | /** |
| 55 | * @var string |
| 56 | */ |
| 57 | public $isProd; |
| 58 | |
| 59 | /** |
| 60 | * Create a new message instance. |
| 61 | * |
| 62 | * @return void |
| 63 | */ |
| 64 | public function __construct($flyshareToken, $firstName, $lastName, $shortcutPreview, $message, $flymsgCount = 1) |
| 65 | { |
| 66 | $this->flyshareToken = $flyshareToken; |
| 67 | $this->firstName = $firstName; |
| 68 | $this->lastName = $lastName; |
| 69 | $this->personalMessage = $message; |
| 70 | $this->shortcutPreview = $shortcutPreview; |
| 71 | $this->flymsgCount = $flymsgCount; |
| 72 | $this->baseUrl = $this->baseUrl(); |
| 73 | $this->inviteLink = $this->baseUrl().$this->pathUrl(); |
| 74 | $this->isProd = $this->isProd(); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Build the message. |
| 79 | */ |
| 80 | public function build(): static |
| 81 | { |
| 82 | return $this->subject("{$this->firstName} {$this->lastName} has shared a FlyMSG with you") |
| 83 | ->view('mail.user.flyshare'); |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Get the base url for the frontend |
| 88 | */ |
| 89 | protected function baseUrl(): string |
| 90 | { |
| 91 | return config('romeo.frontend-base-url'); |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Get the relative url path |
| 96 | */ |
| 97 | protected function pathUrl(): string |
| 98 | { |
| 99 | return "/share/{$this->flyshareToken}?f={$this->firstName}&l={$this->lastName}"; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Get if app is in production |
| 104 | */ |
| 105 | protected function isProd(): bool |
| 106 | { |
| 107 | return config('app.env') === 'production'; |
| 108 | } |
| 109 | } |