ctrlpanel/app/Notifications/Ticket/User/ReplyNotification.php
Shift 70208d2157
Apply Laravel coding style
Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions.

You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root.

For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
2023-01-05 17:01:42 +00:00

81 lines
2 KiB
PHP

<?php
namespace App\Notifications\Ticket\User;
use App\Models\Ticket;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class ReplyNotification extends Notification implements ShouldQueue
{
//THIS IS BASICALLY NOT USED ANYMORE WITH INVOICENOTIFICATION IN PLACE
use Queueable;
private Ticket $ticket;
private User $user;
private $newmessage;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct(Ticket $ticket, User $user, $newmessage)
{
$this->ticket = $ticket;
$this->user = $user;
$this->newmessage = $newmessage;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
$via = ['mail', 'database'];
return $via;
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->subject('[Ticket ID: '.$this->ticket->ticket_id.'] '.$this->ticket->title)
->markdown('mail.ticket.user.reply', ['ticket' => $this->ticket, 'user' => $this->user, 'newmessage' => $this->newmessage]);
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
'title' => '[Ticket ID: '.$this->ticket->ticket_id.'] '.$this->ticket->title,
'content' => "
<p>Ticket With ID : {$this->ticket->ticket_id} A response has been added to your ticket. Please see below for our response!</p>
<br>
<p><strong>Message:</strong></p>
<p>{$this->newmessage}</p>
",
];
}
}