<?php
namespace App\Notifications;
use App\Models\Complaint;
use Illuminate\Notifications\Notification;
class NewComplaintSubmitted extends Notification
{
public function __construct(private readonly Complaint $complaint)
{
//
}
/**
* @return array<int, string>
*/
public function via(object $notifiable): array
{
return ['database'];
}
/**
* @return array<string, mixed>
*/
public function toArray(object $notifiable): array
{
return [
'complaint_id' => $this->complaint->id,
'ticket_number' => $this->complaint->ticket_number,
'subject' => $this->complaint->subject,
'client_name' => $this->complaint->client->name,
'message' => "Tiket baru {$this->complaint->ticket_number} dari {$this->complaint->client->name} menunggu diambil teknisi.",
'url' => route('admin.complaints.show', $this->complaint),
];
}
}