osb/app/Mail/OrderRequest.php

57 lines
1.1 KiB
PHP

<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Models\Service;
class OrderRequest extends Mailable
{
use Queueable, SerializesModels;
public $service;
public $notes;
/**
* Create a new message instance.
*
* @param Service $o
* @param string $notes
*/
public function __construct(Service $o,$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('NBN: %s',$this->service->type->service_address);
break;
case 'App\Models\Service\Voip':
$subject = sprintf('VOIP: %s',$this->service->type->service_number);
break;
default:
$subject = 'New Order Request';
}
return $this
->markdown('email.admin.order.approve')
->subject($subject)
->with(['site'=>$this->service->site]);
}
}