osb/app/Mail/OrderRequestApprove.php

58 lines
1.2 KiB
PHP
Raw Permalink 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 Illuminate\Support\Facades\Config;
2018-08-23 05:17:26 +00:00
use App\Models\Service;
class OrderRequestApprove extends Mailable
{
use Queueable, SerializesModels;
public Service $so;
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->so = $o;
2018-08-23 05:17:26 +00:00
$this->notes = $notes;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
Config::set('site',$this->so->site);
2022-04-19 07:07:39 +00:00
// @todo This is not consistent with Cancel/Change Request
switch ($this->so->product->category) {
case 'broadband': $subject = sprintf('%s: %s',$this->so->product->category,$this->so->type->service_address);
2018-08-23 06:31:46 +00:00
break;
case 'phone': $subject = sprintf('%s: %s',$this->so->product->category,$this->so->type->service_number);
2018-08-23 06:31:46 +00:00
break;
default:
$subject = 'New Order Request';
}
2018-08-23 05:17:26 +00:00
return $this
->markdown('mail.admin.order.approve')
2018-08-23 06:31:46 +00:00
->subject($subject)
->with(['site'=>$this->so->site]);
2018-08-23 05:17:26 +00:00
}
}