2022-08-01 16:52:16 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Notifications\Ticket\User;
|
|
|
|
|
|
|
|
use App\Models\Ticket;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
|
|
|
|
class CreateNotification extends Notification implements ShouldQueue
|
|
|
|
{
|
|
|
|
//THIS IS BASICALLY NOT USED ANYMORE WITH INVOICENOTIFICATION IN PLACE
|
|
|
|
|
|
|
|
use Queueable;
|
|
|
|
|
|
|
|
private Ticket $ticket;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new notification instance.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct(Ticket $ticket)
|
|
|
|
{
|
|
|
|
$this->ticket = $ticket;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the notification's delivery channels.
|
|
|
|
*
|
|
|
|
* @param mixed $notifiable
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function via($notifiable)
|
|
|
|
{
|
2023-01-05 17:01:42 +00:00
|
|
|
$via = ['mail', 'database'];
|
|
|
|
|
2022-08-01 16:52:16 +00:00
|
|
|
return $via;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the mail representation of the notification.
|
|
|
|
*
|
|
|
|
* @param mixed $notifiable
|
|
|
|
* @return MailMessage
|
|
|
|
*/
|
|
|
|
public function toMail($notifiable)
|
|
|
|
{
|
|
|
|
return (new MailMessage)
|
2023-01-05 17:01:42 +00:00
|
|
|
->subject('[Ticket ID: '.$this->ticket->ticket_id.'] '.$this->ticket->title)
|
|
|
|
->markdown('mail.ticket.user.create', ['ticket' => $this->ticket]);
|
2022-08-01 16:52:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the array representation of the notification.
|
|
|
|
*
|
2023-01-05 17:01:42 +00:00
|
|
|
* @param mixed $notifiable
|
2022-08-01 16:52:16 +00:00
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function toArray($notifiable)
|
|
|
|
{
|
|
|
|
return [
|
2023-01-05 17:01:42 +00:00
|
|
|
'title' => '[Ticket ID: '.$this->ticket->ticket_id.'] '.$this->ticket->title,
|
2022-08-01 16:52:16 +00:00
|
|
|
'content' => "Your Ticket has been Created With ID : {$this->ticket->ticket_id}",
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|