validated()); $performances = $query->hasSearchCriteria() ? $action->search($query, $request->schema()) : $action->index(Performance::query(), $query, $request->schema()); return new PerformanceCollection($performances, $query); } /** * Store a newly created resource. * * @param StoreRequest $request * @param StoreAction $action * @return PerformanceResource */ public function store(StoreRequest $request, StoreAction $action): PerformanceResource { $performance = $action->store(Performance::query(), $request->validated()); return new PerformanceResource($performance, new Query()); } /** * Display the specified resource. * * @param ShowRequest $request * @param Performance $performance * @param ShowAction $action * @return PerformanceResource */ public function show(ShowRequest $request, Performance $performance, ShowAction $action): PerformanceResource { $query = new Query($request->validated()); $show = $action->show($performance, $query, $request->schema()); return new PerformanceResource($show, $query); } /** * Update the specified resource. * * @param UpdateRequest $request * @param Performance $performance * @param UpdateAction $action * @return PerformanceResource */ public function update(UpdateRequest $request, Performance $performance, UpdateAction $action): PerformanceResource { $updated = $action->update($performance, $request->validated()); return new PerformanceResource($updated, new Query()); } /** * Remove the specified resource. * * @param Performance $performance * @param DestroyAction $action * @return PerformanceResource */ public function destroy(Performance $performance, DestroyAction $action): PerformanceResource { $deleted = $action->destroy($performance); return new PerformanceResource($deleted, new Query()); } /** * Restore the specified resource. * * @param Performance $performance * @param RestoreAction $action * @return PerformanceResource */ public function restore(Performance $performance, RestoreAction $action): PerformanceResource { $restored = $action->restore($performance); return new PerformanceResource($restored, new Query()); } /** * Hard-delete the specified resource. * * @param Performance $performance * @param ForceDeleteAction $action * @return JsonResponse */ public function forceDelete(Performance $performance, ForceDeleteAction $action): JsonResponse { $message = $action->forceDelete($performance); return new JsonResponse([ 'message' => $message, ]); } }