47 lines
1.4 KiB
PHP
47 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use App\Models\Feedback;
|
|
use App\Models\User;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class TicketClosed extends Notification
|
|
{
|
|
use Queueable;
|
|
|
|
public function __construct(
|
|
public Feedback $feedback,
|
|
public User $actor,
|
|
) {}
|
|
|
|
public function via(object $notifiable): array
|
|
{
|
|
return ['database', 'mail'];
|
|
}
|
|
|
|
public function toMail(object $notifiable): MailMessage
|
|
{
|
|
return (new MailMessage)
|
|
->subject(__('feedback.notif_ticket_closed_subject', ['id' => $this->feedback->id]))
|
|
->line(__('feedback.notif_ticket_closed_ticket', ['title' => $this->feedback->title]))
|
|
->line(__('feedback.notif_ticket_closed_by', ['name' => $this->actor->name]))
|
|
->action(__('feedback.notif_view_ticket'), url('/admin/feedbacks/' . $this->feedback->id . '/edit'));
|
|
}
|
|
|
|
public function toDatabase(object $notifiable): array
|
|
{
|
|
return [
|
|
'message' => __('feedback.notif_ticket_closed_message', [
|
|
'id' => $this->feedback->id,
|
|
'title' => $this->feedback->title,
|
|
'actor' => $this->actor->name,
|
|
]),
|
|
'feedback_id' => $this->feedback->id,
|
|
'actor_name' => $this->actor->name,
|
|
];
|
|
}
|
|
}
|