2019-01-24 03:40:33 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Mail;
|
|
|
|
|
|
|
|
use Illuminate\Bus\Queueable;
|
2021-09-29 04:57:25 +00:00
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
2019-01-24 03:40:33 +00:00
|
|
|
use Illuminate\Mail\Mailable;
|
|
|
|
use Illuminate\Queue\SerializesModels;
|
2022-09-29 02:16:08 +00:00
|
|
|
use Illuminate\Support\Facades\Config;
|
2019-01-24 03:40:33 +00:00
|
|
|
|
|
|
|
use App\Models\Service;
|
|
|
|
|
|
|
|
class OrderRequest extends Mailable
|
|
|
|
{
|
|
|
|
use Queueable, SerializesModels;
|
|
|
|
|
2021-09-29 04:57:25 +00:00
|
|
|
public Service $service;
|
|
|
|
public string $notes;
|
2019-01-24 03:40:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new message instance.
|
|
|
|
*
|
|
|
|
* @param Service $o
|
|
|
|
* @param string $notes
|
|
|
|
*/
|
2021-09-29 04:57:25 +00:00
|
|
|
public function __construct(Service $o,string $notes='')
|
2019-01-24 03:40:33 +00:00
|
|
|
{
|
|
|
|
$this->service = $o;
|
|
|
|
$this->notes = $notes;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Build the message.
|
|
|
|
*
|
|
|
|
* @return $this
|
|
|
|
*/
|
|
|
|
public function build()
|
|
|
|
{
|
2022-09-29 02:16:08 +00:00
|
|
|
Config::set('site',$this->service->site);
|
|
|
|
|
2021-09-29 04:57:25 +00:00
|
|
|
switch (get_class($this->service->type)) {
|
2023-05-05 06:29:08 +00:00
|
|
|
case Service\Broadband::class:
|
2022-04-19 07:07:39 +00:00
|
|
|
$subject = sprintf('Order BROADBAND: %s',$this->service->type->service_address);
|
2019-01-24 03:40:33 +00:00
|
|
|
break;
|
|
|
|
|
2023-05-05 06:29:08 +00:00
|
|
|
case Service\Phone::class:
|
2022-04-19 07:07:39 +00:00
|
|
|
$subject = sprintf('Order PHONE: %s',$this->service->type->service_number);
|
2019-01-24 03:40:33 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
$subject = 'New Order Request';
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this
|
|
|
|
->markdown('email.admin.order.approve')
|
|
|
|
->subject($subject)
|
|
|
|
->with(['site'=>$this->service->site]);
|
|
|
|
}
|
|
|
|
}
|