You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.2 KiB
45 lines
1.2 KiB
<?php
|
|
|
|
namespace App\AdminAgent\Renderable;
|
|
use App\AdminAgent\Repositories\User;
|
|
use App\Common\UserStatus;
|
|
use Dcat\Admin\Admin;
|
|
use Dcat\Admin\Grid;
|
|
use Dcat\Admin\Grid\LazyRenderable;
|
|
|
|
/**
|
|
* 选择会员
|
|
* Class SelectProduct
|
|
* @package App\AdminAgent\Renderable
|
|
*/
|
|
class SelectUser extends LazyRenderable
|
|
{
|
|
public function grid(): Grid
|
|
{
|
|
// 获取外部传递的参数
|
|
// $id = $this->id;
|
|
Admin::translation('user');
|
|
return Grid::make(new User(), function (Grid $grid) {
|
|
$grid->disableActions();
|
|
$grid->disableBatchDelete();
|
|
$grid->disableBatchActions();
|
|
|
|
$grid->model()->where(['status' => UserStatus::NORMAL, 'agent_id' => Admin::user()->id]);
|
|
$grid->quickSearch(['mobile', 'nickname'])->placeholder('搜索手机号、用户昵称');
|
|
|
|
$grid->column('id');
|
|
$grid->column('nickname');
|
|
$grid->column('mobile');
|
|
$grid->column('avatar')->image('', 60, 60);
|
|
$grid->column('created_at', '注册时间');
|
|
|
|
$grid->paginate(15);
|
|
|
|
$grid->filter(function (Grid\Filter $filter) {
|
|
$filter->model()->where('agent_id', Admin::user()->id);
|
|
$filter->equal('mobile')->width(3);
|
|
$filter->like('nickname')->width(3);
|
|
});
|
|
});
|
|
}
|
|
}
|