payload['id'] ?? 0; $user = User::findOrFail($id); try { DB::beginTransaction(); $user->userInfo->update([ 'is_company' => $input['is_company'] ]); DB::commit(); } catch (Throwable $th) { DB::rollBack(); report($th); return $this->response()->error('操作失败:'.$th->getMessage()); } return $this->response()->success(__('admin.update_succeeded'))->refresh(); } /** * Build a form here. */ public function form() { $id = $this->payload['id'] ?? 0; $user = User::with(['userInfo'])->findOrFail($id); $this->radio('is_company', '员工')->value($user->userInfo->is_company)->options([1 => '是', 0 => '否']); } }