|
@@ -1,13 +1,11 @@
|
|
<?php
|
|
<?php
|
|
|
|
+
|
|
namespace App\Admin\Actions\Users;
|
|
namespace App\Admin\Actions\Users;
|
|
|
|
|
|
-use App\Models\User;
|
|
|
|
use App\Models\UserInfoModel;
|
|
use App\Models\UserInfoModel;
|
|
use Dcat\Admin\Contracts\LazyRenderable;
|
|
use Dcat\Admin\Contracts\LazyRenderable;
|
|
use Dcat\Admin\Traits\LazyWidget;
|
|
use Dcat\Admin\Traits\LazyWidget;
|
|
use Dcat\Admin\Widgets\Form;
|
|
use Dcat\Admin\Widgets\Form;
|
|
-use Dcat\Admin\Form as toForm;
|
|
|
|
-use PHPUnit\Util\Exception;
|
|
|
|
|
|
|
|
class UsersInfoForm extends Form implements LazyRenderable
|
|
class UsersInfoForm extends Form implements LazyRenderable
|
|
{
|
|
{
|
|
@@ -21,7 +19,7 @@ class UsersInfoForm extends Form implements LazyRenderable
|
|
public function handle(array $input)
|
|
public function handle(array $input)
|
|
{
|
|
{
|
|
$user_info = UserInfoModel::query()->find($input['user_id']);
|
|
$user_info = UserInfoModel::query()->find($input['user_id']);
|
|
- if(!$user_info){
|
|
|
|
|
|
+ if (!$user_info) {
|
|
return $this->response()->error('请刷新后重试');
|
|
return $this->response()->error('请刷新后重试');
|
|
}
|
|
}
|
|
$user_info->update($input);
|
|
$user_info->update($input);
|
|
@@ -31,12 +29,12 @@ class UsersInfoForm extends Form implements LazyRenderable
|
|
|
|
|
|
public function form()
|
|
public function form()
|
|
{
|
|
{
|
|
- if(request()->ajax()){
|
|
|
|
- $user_info = UserInfoModel::query()->where('user_id',$this->payload['user_id'])->first();
|
|
|
|
|
|
+ if (request()->ajax()) {
|
|
|
|
+ $user_info = UserInfoModel::query()->where('user_id', $this->payload['user_id'])->first();
|
|
$this->fill($user_info);
|
|
$this->fill($user_info);
|
|
}
|
|
}
|
|
|
|
|
|
- $this->text('user_id',"用户ID")->readOnly();
|
|
|
|
|
|
+ $this->text('user_id', "用户ID")->readOnly();
|
|
$this->text('nickname', '昵称')->required();
|
|
$this->text('nickname', '昵称')->required();
|
|
$this->image('avatar', '头像')->disk('oss')->saveFullUrl()->uniqueName()->removable(false)->autoUpload();
|
|
$this->image('avatar', '头像')->disk('oss')->saveFullUrl()->uniqueName()->removable(false)->autoUpload();
|
|
$this->text('weixin', '微信号');
|
|
$this->text('weixin', '微信号');
|
|
@@ -53,9 +51,9 @@ class UsersInfoForm extends Form implements LazyRenderable
|
|
$this->text('hobby', '兴趣爱好')->help("多个字段用,隔开,例如:唱歌,跳舞");
|
|
$this->text('hobby', '兴趣爱好')->help("多个字段用,隔开,例如:唱歌,跳舞");
|
|
$this->text('drink', '喝酒');
|
|
$this->text('drink', '喝酒');
|
|
$this->text('smoke', '抽烟');
|
|
$this->text('smoke', '抽烟');
|
|
- $this->array('photo', function (toForm $form) {
|
|
|
|
- $form->image('url','图片')->saveFullUrl()->uniqueName()->removable(false)->autoUpload();;
|
|
|
|
- $form->radio('state','阅后即焚')->options([0=>"否",1=>"是"])->default(0);
|
|
|
|
|
|
+ $this->array('photo', function (Form $form) {
|
|
|
|
+ $form->image('url', '图片')->disk("oss")->saveFullUrl()->uniqueName()->removable(false)->autoUpload();;
|
|
|
|
+ $form->radio('state', '阅后即焚')->options([0 => "否", 1 => "是"])->default(0);
|
|
})->saveAsJson()->label('相册');
|
|
})->saveAsJson()->label('相册');
|
|
//$this->file('video', '视频')->saveAsJson();
|
|
//$this->file('video', '视频')->saveAsJson();
|
|
}
|
|
}
|