Attendize/app/Notifications/TicketCommented.php

66 lines
1.5 KiB
PHP
Raw Normal View History

2020-05-06 15:53:50 +00:00
<?php
namespace App\Notifications;
use App\Models\HelpTicketComment;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
2020-05-06 16:01:08 +00:00
class TicketCommented extends Notification implements ShouldQueue
2020-05-06 15:53:50 +00:00
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
protected $comment;
2020-05-15 07:22:05 +00:00
public $tries = 2;
2020-05-06 15:53:50 +00:00
public function __construct(HelpTicketComment $comment)
{
$this->comment = $comment;
//
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
2020-05-08 10:54:00 +00:00
return ['mail','database'];
2020-05-06 15:53:50 +00:00
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->line('The introduction to the notification.')
->action('Notification Action', url('/'))
->line('Thank you for using our application!');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
2020-05-08 10:54:00 +00:00
public function toDatabase($notifiable)
2020-05-06 15:53:50 +00:00
{
2020-05-08 10:54:00 +00:00
return $this->comment->toArray();
2020-05-06 15:53:50 +00:00
}
}