diff --git a/app/Admin/Controllers/UserController.php b/app/Admin/Controllers/UserController.php new file mode 100644 index 0000000..2583fe8 --- /dev/null +++ b/app/Admin/Controllers/UserController.php @@ -0,0 +1,81 @@ +disableRowSelector(); + $grid->disableCreateButton(); + $grid->disableActions(); + + $grid->column('id')->sortable(); + $grid->column('agent.agent_name', '代理商账号'); + $grid->column('avatar')->image(60, 60); + $grid->column('mobile'); + $grid->column('nickname'); + $grid->column('status')->bool(); + $grid->column('verifier')->bool(); + $grid->column('created_at')->display(fn($v) => $v); + $grid->column('updated_at')->display(fn($v) => $v); + + $grid->filter(function (Grid\Filter $filter) { + $filter->panel(); + + $filter->equal('id')->width(1); + $filter->equal('mobile')->width(2); + }); + }); + } + + /** + * Make a show builder. + * + * @param mixed $id + * + * @return Show + */ + protected function detail($id) + { + return Show::make($id, new User(), function (Show $show) { + /*$show->field('id'); + $show->field('agent_id'); + $show->field('avatar'); + $show->field('mobile'); + $show->field('nickname'); + $show->field('openid'); + $show->field('status'); + $show->field('unionid'); + $show->field('verifier'); + $show->field('created_at'); + $show->field('updated_at');*/ + }); + } + + /** + * Make a form builder. + * + * @return Form + */ + protected function form() + { + return Form::make(new User(), function (Form $form) { + /*$form->display('id'); + $form->text('status'); + $form->text('verifier');*/ + }); + } +} diff --git a/app/Admin/Repositories/User.php b/app/Admin/Repositories/User.php new file mode 100644 index 0000000..fe33e25 --- /dev/null +++ b/app/Admin/Repositories/User.php @@ -0,0 +1,16 @@ + [ + 'User' => '用户列表', + 'user' => '用户列表', + ], + 'fields' => [ + 'agent_id' => '代理商ID', + 'agent' => ['agent_name' => '代理商名称'], + 'avatar' => '头像', + 'mobile' => '手机号', + 'nickname' => '昵称', + 'openid' => '微信openid', + 'status' => '用户状态', + 'unionid' => '微信unionid', + 'verifier' => '是否核销人员', + 'created_at' => '注册时间', + ], + 'options' => [ + ], +];