Commit e7545fde by 宁成龙

用户列表curd

parent 176260cb
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\User;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class UserController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new User(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('user_sn');
$grid->column('name');
$grid->column('email');
$grid->column('email_verified_at');
$grid->column('password');
$grid->column('phone');
$grid->column('remember_token');
$grid->column('account_properties');
$grid->column('status');
$grid->column('company_name');
$grid->column('first_name');
$grid->column('sale_id');
$grid->column('sale_name');
$grid->column('last_name');
$grid->column('created_time');
$grid->column('update_time');
$grid->column('created_at');
$grid->column('updated_at')->sortable();
$grid->filter(function (Grid\Filter $filter) {
$filter->equal('id');
});
});
}
/**
* 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('user_sn');
$show->field('name');
$show->field('email');
$show->field('email_verified_at');
$show->field('password');
$show->field('phone');
$show->field('remember_token');
$show->field('account_properties');
$show->field('status');
$show->field('company_name');
$show->field('first_name');
$show->field('sale_id');
$show->field('sale_name');
$show->field('last_name');
$show->field('created_time');
$show->field('update_time');
$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('user_sn');
$form->text('name');
$form->text('email');
$form->text('email_verified_at');
$form->text('password');
$form->text('phone');
$form->text('remember_token');
$form->text('account_properties');
$form->text('status');
$form->text('company_name');
$form->text('first_name');
$form->text('sale_id');
$form->text('sale_name');
$form->text('last_name');
$form->text('created_time');
$form->text('update_time');
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Repositories;
use App\Models\User as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class User extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
<?php
return [
'labels' => [
'User' => 'User',
'user' => 'User',
],
'fields' => [
'user_sn' => '客户编码',
'name' => '用户名',
'email' => '邮箱',
'email_verified_at' => '邮箱校验时间',
'password' => '密码',
'phone' => '手机号码',
'remember_token' => '记住登陆token',
'account_properties' => '账号属性,1是个人,2是企业',
'status' => '状态,1是正常,-1是禁用',
'company_name' => '公司名称',
'first_name' => '名字',
'sale_id' => '业务员',
'sale_name' => '业务员名字',
'last_name' => '姓氏',
'created_time' => '创建时间',
'update_time' => '更新时间',
],
'options' => [
],
];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment