validated()); $performances = $query->hasSearchCriteria() ? $action->search($query, $request->schema()) : $action->index(Performance::query(), $query, $request->schema()); return new PerformanceCollection($performances, $query); } /** * @param StoreAction $action */ public function store(StoreRequest $request, StoreAction $action): PerformanceJsonResource { $performance = $action->store(Performance::query(), $request->validated()); return new PerformanceJsonResource($performance, new Query()); } public function show(ShowRequest $request, Performance $performance, ShowAction $action): PerformanceJsonResource { $query = new Query($request->validated()); $show = $action->show($performance, $query, $request->schema()); return new PerformanceJsonResource($show, $query); } public function update(UpdateRequest $request, Performance $performance, UpdateAction $action): PerformanceJsonResource { $updated = $action->update($performance, $request->validated()); return new PerformanceJsonResource($updated, new Query()); } public function destroy(Performance $performance, DestroyAction $action): PerformanceJsonResource { $deleted = $action->destroy($performance); return new PerformanceJsonResource($deleted, new Query()); } public function restore(Performance $performance, RestoreAction $action): PerformanceJsonResource { $restored = $action->restore($performance); return new PerformanceJsonResource($restored, new Query()); } public function forceDelete(Performance $performance, ForceDeleteAction $action): JsonResponse { $message = $action->forceDelete($performance); return new JsonResponse([ 'message' => $message, ]); } }