osb/app/Mail/ChangeRequest.php

56 lines
1.1 KiB
PHP
Raw Normal View History

2021-09-29 04:57:25 +00:00
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use App\Models\Service;
class ChangeRequest extends Mailable
{
use Queueable, SerializesModels;
public Service $service;
public string $notes;
/**
* Create a new message instance.
*
* @param Service $o
* @param string $notes
*/
public function __construct(Service $o,string $notes='')
{
$this->service = $o;
$this->notes = $notes;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
switch (get_class($this->service->type)) {
case 'App\Models\Service\Adsl':
$subject = sprintf('Change NBN: %s',$this->service->type->service_address);
break;
case 'App\Models\Service\Voip':
$subject = sprintf('Change VOIP: %s',$this->service->type->service_number);
break;
default:
$subject = 'Change Service Request';
}
return $this
->markdown('email.admin.service.change')
->subject($subject)
->with(['site'=>$this->service->site]);
}
}