timeSlots()->orderBy('date')->orderBy('start_time')->get(); return TimeSlotResource::collection($timeSlots); } public function store(StoreTimeSlotRequest $request, Event $event): JsonResponse { Gate::authorize('create', [TimeSlot::class, $event]); $timeSlot = $event->timeSlots()->create($request->validated()); return $this->created(new TimeSlotResource($timeSlot)); } public function update(UpdateTimeSlotRequest $request, Event $event, TimeSlot $timeSlot): JsonResponse { Gate::authorize('update', [$timeSlot, $event]); $timeSlot->update($request->validated()); return $this->success(new TimeSlotResource($timeSlot->fresh())); } public function destroy(Event $event, TimeSlot $timeSlot): JsonResponse { Gate::authorize('delete', [$timeSlot, $event]); $timeSlot->delete(); return response()->json(null, 204); } }