Files
Helpddesk/resources/themes/backend/views/modules/helpdesk/partials/ticket-time-log-history-query.blade.php
2026-09-02 17:08:57 +00:00

17 lines
590 B
PHP
Executable File

@php
$ticketTimeLogs = \Modules\Helpdesk\Models\TicketTimeLog::query()
->with('user')
->where('ticket_id', $ticket->getKey())
->whereNotNull('ended_at')
->latest('logged_at')
->get();
$ticketLoggedSeconds = (int) $ticketTimeLogs->sum(function ($timeLog) {
return (int) ($timeLog->seconds ?? ((int) $timeLog->minutes * 60));
});
$ticketLoggedHours = intdiv($ticketLoggedSeconds, 3600);
$ticketLoggedMinutes = intdiv($ticketLoggedSeconds % 3600, 60);
$ticketLoggedRemainingSeconds = $ticketLoggedSeconds % 60;
@endphp