'=', 'complaint_id' => '=', 'worker_id' => '=', ]; protected array $quickSearchField = ['content']; #[GetRoute(authorize: 'query')] public function query(Request $request): JsonResponse { $params = $request->all(); $pageSize = $params['pageSize'] ?? 10; $query = RunnerComplaintAppealModel::query(); $data = $this->buildSearch($params, $query) ->paginate($pageSize) ->toArray(); return $this->success($data); } #[PostRoute(authorize: 'create')] public function create(RunnerComplaintAppealFormRequest $request): JsonResponse { RunnerComplaintAppealModel::create($request->validated()); return $this->success(); } #[PutRoute( route: '/{id}', authorize: 'update', where: ['id' => '[0-9]+'] )] public function update(int $id, RunnerComplaintAppealFormRequest $request): JsonResponse { $model = RunnerComplaintAppealModel::find($id); if (empty($model)) { return $this->error('申诉记录不存在'); } $model->update($request->validated()); return $this->success(); } #[DeleteRoute( route: '/{id}', authorize: 'delete', where: ['id' => '[0-9]+'] )] public function delete(int $id): JsonResponse { $model = RunnerComplaintAppealModel::find($id); if (empty($model)) { return $this->error('申诉记录不存在'); } $model->delete(); return $this->success(); } }