Commit 39f507e5 by 宁成龙

增加过滤

parent 7d080f56
Showing with 7 additions and 3 deletions
...@@ -28,8 +28,12 @@ class EditUserHandle extends Form implements LazyRenderable ...@@ -28,8 +28,12 @@ class EditUserHandle extends Form implements LazyRenderable
// $userList = User::getListByIdArr($ids); // $userList = User::getListByIdArr($ids);
$userInfo = User::getInfoByUserId($id); $userInfo = User::getInfoByUserId($id);
if (!$userInfo) { if (!$userInfo) {
throw new \Exception('客户不存在'); throw new \Exception("Record not found");
} }
$input = array_filter($input, function ($value) {
return $value !== null;
});
User::updateById($id, $input); User::updateById($id, $input);
return $this return $this
->response() ->response()
...@@ -37,7 +41,7 @@ class EditUserHandle extends Form implements LazyRenderable ...@@ -37,7 +41,7 @@ class EditUserHandle extends Form implements LazyRenderable
->refresh(); ->refresh();
} catch (\Throwable $throwable) { } catch (\Throwable $throwable) {
// var_dump((string)$throwable); // var_dump((string)$throwable);
return $this->response()->error(trans('admin.update_failed')); return $this->response()->error(trans('admin.update_failed')." :{$throwable->getMessage()}");
} }
} }
...@@ -50,7 +54,7 @@ class EditUserHandle extends Form implements LazyRenderable ...@@ -50,7 +54,7 @@ class EditUserHandle extends Form implements LazyRenderable
$this->hidden('id')->attribute('id', 'id')->width(4); $this->hidden('id')->attribute('id', 'id')->width(4);
$this->row(function (Row $form) { $this->row(function (Row $form) {
$form->width(5)->text('company_name')->required(); $form->width(5)->text('company_name')->required();
$form->width(5)->text('user_sn'); $form->width(5)->text('user_sn')->disable();
}); });
$this->row(function (Row $form) { $this->row(function (Row $form) {
$form->width(5)->text('first_name')->required(); $form->width(5)->text('first_name')->required();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment