payload['id']) ? $this->payload['id'] : 0; $this->hidden('id')->value($id); $this->text('name', '场地名称'); } //点击表单处理 public function handle(array $input) { try { if(\App\Models\CourseField::query()->where('course_id', $input['id'])->where('name', $input['name'])->first()){ return $this->response()->error('已存在'); }; $courseField = App::make('getCourseFieldInstance'); $courseField->course_id = $input['id']; $courseField->name = $input['name']; $courseField->save(); } catch (\Exception $exception) { return $this->response()->error($exception->getMessage()); } return $this->response()->success('success')->refresh(); } }