osb/app/Mail/OrderRequestApprove.php

54 lines
1.1 KiB
PHP
Raw Normal View History

2018-08-23 05:17:26 +00:00
<?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 OrderRequestApprove extends Mailable
{
use Queueable, SerializesModels;
public Service $service;
public string $notes;
2018-08-23 05:17:26 +00:00
/**
* Create a new message instance.
*
* @param Service $o
* @param string $notes
*/
public function __construct(Service $o,string $notes='')
2018-08-23 05:17:26 +00:00
{
$this->service = $o;
$this->notes = $notes;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
switch ($this->service->category) {
2018-08-23 06:31:46 +00:00
case 'ADSL': $subject = sprintf('%s: %s',$this->service->category,$this->service->service_adsl->service_address);
break;
case 'VOIP': $subject = sprintf('%s: %s',$this->service->category,$this->service->service_voip->service_number);
break;
default:
$subject = 'New Order Request';
}
2018-08-23 05:17:26 +00:00
return $this
->markdown('email.admin.order.approve')
2018-08-23 06:31:46 +00:00
->subject($subject)
->with(['site'=>$this->service->site]);
2018-08-23 05:17:26 +00:00
}
}