Files
baodev0 0b08689ea4 feat: harden admin auth and ticket workflows
- add rotating admin refresh tokens and password gates\n- expand ticket galleries, exports, and client resources\n- improve IP allocation auditing and dashboard data\n- enforce encrypted client access tokens on public routes
2026-10-16 17:00:55 +07:00

56 lines
1.4 KiB
PHP

<?php
namespace App\Exports;
use App\Models\Ticket;
use Illuminate\Database\Eloquent\Builder;
final class TicketsExport implements BrandedReport
{
public function __construct(private readonly Builder $query) {}
public function title(): string
{
return 'Danh sách ticket hỗ trợ';
}
public function query(): Builder
{
return $this->query;
}
public function moneyColumns(): array
{
return [];
}
public function headings(): array
{
return [
'Mã ticket', 'Tiêu đề', 'Khách hàng', 'Email', 'Phòng ban', 'Mức ưu tiên',
'Trạng thái', 'Số phản hồi', 'Ngày tạo', 'Cập nhật lần cuối',
];
}
/**
* @param Ticket $ticket
*/
public function map($ticket): array
{
$priority = $ticket->priority();
return [
$ticket->ticket_num,
$ticket->subject,
$ticket->customer?->fullname,
$ticket->customer?->email,
$ticket->roomLabel(),
$priority ? (Ticket::PRIORITY_LABELS[$priority] ?? $priority) : null,
Ticket::STATUS_LABELS[$ticket->status] ?? $ticket->status,
(int) $ticket->reply_count,
$ticket->created_at?->format('d/m/Y H:i'),
$ticket->updated_at?->format('d/m/Y H:i'),
];
}
}