ldc-supportweb/app/Mail/TicketUpdate.php

48 lines
1.1 KiB
PHP
Raw Normal View History

<?php
namespace App\Mail;
use App\Lib\ToolboxHelper;
2021-05-18 22:52:46 +02:00
use App\Models\Ticket;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class TicketUpdate extends Mailable
{
2021-05-18 22:52:46 +02:00
use Queueable;
use SerializesModels;
2022-08-30 13:21:07 +00:00
/** @var \App\Models\Ticket */
2021-05-18 22:52:46 +02:00
private $ticket;
/** @var string */
private $corpsMaj;
/**
* Create a new message instance.
*
2022-08-30 13:21:07 +00:00
* @param \App\Models\Ticket $ticket
* @param string $corpsMaj
* @return void
*/
2021-05-18 22:52:46 +02:00
public function __construct(Ticket $ticket, string $corpsMaj)
{
2022-03-29 16:57:54 +02:00
$this->ticket = $ticket;
$this->corpsMaj = $corpsMaj;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
2022-03-29 16:57:54 +02:00
$ticket = $this->ticket;
$corpsMaj = \html_entity_decode(ToolboxHelper::plainToHtml($this->corpsMaj));
return $this->subject("[SupportWeb][{$ticket->site->name}] Ticket n°$ticket->id")
2021-07-23 12:06:08 +02:00
->view('emails.ticket-update', compact('ticket', 'corpsMaj'));
}
}