- Departments + cross-department transfer workflow - Role-based closing (staff→resolved, manager→closed) with proof_of_resolution - Private file storage with collection system + temporary signed URLs - Dashboard: resolved tickets table, stats, handler performance bar chart - Spatie RBAC (admin/manager/staff) - Notifications: TicketTransferred, TicketClosed (database + mail) - Pest tests: 8 tests, 21 assertions - Docker production-ready (Dockerfile + compose + entrypoint)
52 lines
1.7 KiB
PHP
52 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use App\Models\Feedback;
|
|
use App\Models\TicketTransferLog;
|
|
use App\Models\User;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class TicketTransferred extends Notification
|
|
{
|
|
use Queueable;
|
|
|
|
public function __construct(
|
|
public Feedback $feedback,
|
|
public TicketTransferLog $transferLog,
|
|
public User $sender,
|
|
) {}
|
|
|
|
public function via(object $notifiable): array
|
|
{
|
|
return ['database', 'mail'];
|
|
}
|
|
|
|
public function toMail(object $notifiable): MailMessage
|
|
{
|
|
return (new MailMessage)
|
|
->subject(__('Ticket #{id} đã được chuyển đến phòng của bạn', ['id' => $this->feedback->id]))
|
|
->line(__('Ticket: :title', ['title' => $this->feedback->title]))
|
|
->line(__('Người chuyển: :name', ['name' => $this->sender->name]))
|
|
->line(__('Lý do: :reason', ['reason' => $this->transferLog->reason]))
|
|
->action(__('Xem Ticket'), url('/admin/feedbacks/' . $this->feedback->id . '/edit'));
|
|
}
|
|
|
|
public function toDatabase(object $notifiable): array
|
|
{
|
|
return [
|
|
'message' => __('Ticket #{id} ":title" đã được chuyển đến phòng của bạn bởi :sender.', [
|
|
'id' => $this->feedback->id,
|
|
'title' => $this->feedback->title,
|
|
'sender' => $this->sender->name,
|
|
]),
|
|
'feedback_id' => $this->feedback->id,
|
|
'sender_name' => $this->sender->name,
|
|
'reason' => $this->transferLog->reason,
|
|
'to_department_id' => $this->transferLog->to_department_id,
|
|
];
|
|
}
|
|
}
|