xiaogang 3 năm trước cách đây
mục cha
commit
8e70d43e16

+ 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());
+        $form = UsersInfoForm::make()->payload(['user_id'=>$this->getKey()]);
         return Modal::make()
             ->lg()
             ->title($this->title)

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

xqd xqd
@@ -11,12 +11,10 @@ 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)
@@ -40,11 +38,11 @@ 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->user_info->user_id)->readOnly();
-        $this->text('nickname', '昵称')->value($this->user_info->nickname);
-        $this->image('avatar', '头像')->view($this->user_info->avatar);
+        $user_info = UserInfoModel::query()->where('user_id',$this->payload['user_id'])->first();
+        $this->fill($user_info);
+        $this->text('user_id',"用户ID");//->value($this->user_info->user_id)->readOnly();
+        $this->text('nickname', '昵称');//->value($this->user_info->nickname);
+        $this->image('avatar', '头像');//->view($this->user_info->avatar);
 
     }
 }