parent_id); $this->row->UpdateRelation($parent); return $this->response()->success('操作成功')->refresh(); } public function form() { $this->text('parent_id', '用户序号')->rules(['required', 'numeric', function ($attribute, $value, $fail) { $parent = User::find($value); if (!$parent) { return $fail('未找到账号'); } if (!in_array($parent->identity->identity_id, [2, 3, 4])) { return $fail('账号等级不够'); } }], [ 'required' => '用户序号不能为空', 'numeric' => '用户序号必须为整数', ], '2'); } }