events() ->latest('start_date') ->paginate(); return EventResource::collection($events); } public function show(Organisation $organisation, Event $event): JsonResponse { Gate::authorize('view', [$event, $organisation]); return $this->success(new EventResource($event->load('organisation'))); } public function store(StoreEventRequest $request, Organisation $organisation): JsonResponse { Gate::authorize('create', [Event::class, $organisation]); $event = $organisation->events()->create($request->validated()); return $this->created(new EventResource($event)); } public function update(UpdateEventRequest $request, Organisation $organisation, Event $event): JsonResponse { Gate::authorize('update', [$event, $organisation]); $event->update($request->validated()); return $this->success(new EventResource($event->fresh())); } }