osb/app/Mail/ChangeRequest.php
Deon George 3b40e92c48
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 37s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s
Improvements for service_change and service_cancel
2024-08-16 08:20:58 +10:00

61 lines
1.2 KiB
PHP

<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Config;
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|NULL $notes
*/
public function __construct(Service $o,string $notes=NULL)
{
$this->service = $o;
$this->notes = $notes;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
Config::set('site',$this->service->site);
switch (get_class($this->service->type)) {
case Service\Broadband::class:
$subject = sprintf('Change BROADBAND: %s (%s)',
$this->service->type->service_number,
$this->service->type->service_address);
break;
case Service\Phone::class:
$subject = sprintf('Change PHONE: %s',$this->service->type->service_number);
break;
default:
$subject = 'Change Service Request';
}
return $this
->markdown('mail.admin.service.change')
->subject($subject)
->with(['site'=>$this->service->site]);
}
}