xiaogang 3 年之前
父節點
當前提交
0f5a1f5067
共有 2 個文件被更改,包括 7 次插入7 次删除
  1. 1 1
      app/Admin/Actions/Users/SetUserInfo.php
  2. 6 6
      app/Admin/Actions/Users/UsersInfoForm.php

+ 1 - 1
app/Admin/Actions/Users/SetUserInfo.php

xqd
@@ -58,7 +58,7 @@ class SetUserInfo extends RowAction
 
     public function render()
     {
-        $form = UsersInfoForm::make(UserInfoModel::query()->where('user_id',$this->getKey())->first(),$this->getKey());
+        $form = UsersInfoForm::make(UserInfoModel::query()->where('user_id')->first());
         return Modal::make()
             ->lg()
             ->title($this->title)

+ 6 - 6
app/Admin/Actions/Users/UsersInfoForm.php

xqd xqd xqd
@@ -11,11 +11,12 @@ use PHPUnit\Util\Exception;
 class UsersInfoForm extends Form implements LazyRenderable
 {
     use LazyWidget;
-
+    private $user_info;
 
     public function __construct($data = [], $key = null)
     {
         parent::__construct($data, $key);
+        $this->user_info = $data;
     }
 
     public function handle(array $input)
@@ -31,7 +32,6 @@ class UsersInfoForm extends Form implements LazyRenderable
         }
         if($input['password']!=''){
             $user->password = $input['password'];
-
         }
         $user->save();
         return $this->response()->success('保存成功')->refresh();
@@ -41,10 +41,10 @@ class UsersInfoForm extends Form implements LazyRenderable
     public function form()
     {
         //$user_info = UserInfoModel::query()->where('user_id',$this->payload['id'])->first();
-        dd($this->data());
-        $this->text('user_id');//->value($this->payload['id'])->readOnly();
-        $this->text('nickname', '昵称');//->value($user_info->nickname);
-        $this->image('avatar', '头像');//->url($user_info->avatar);
+        //dd($this->data());
+        $this->text('user_id')->value($this->user_info->user_id)->readOnly();
+        $this->text('nickname', '昵称')->value($this->user_info->nickname);
+        $this->image('avatar', '头像')->view($this->user_info->avatar);
 
     }
 }