user()?->cannot('update', $ticket)) { throw new AuthorizationException; } $validated = $request->validate([ 'minutes' => ['required', 'integer', 'min:1', 'max:1440'], 'description' => ['nullable', 'string', 'max:1000'], ]); $ticket->increment('time_spent_minutes', (int) $validated['minutes'], [ 'last_activity_at' => now(), ]); return redirect() ->route('helpdesk.tickets.show', $ticket) ->with('ticket-action-updated', 'Time logged successfully.'); } }