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.
92 lines
2.6 KiB
92 lines
2.6 KiB
<?php
|
|
|
|
namespace App\Admin\Controllers\v3;
|
|
|
|
use App\Admin\Repositories\v3\LanzuEmployees;
|
|
use Dcat\Admin\Form;
|
|
use Dcat\Admin\Grid;
|
|
use Dcat\Admin\Show;
|
|
use Dcat\Admin\Controllers\AdminController;
|
|
use App\Models\v3\LanzuEmployees as EmployeesModel;
|
|
use App\Models\v3\User as UserModel;
|
|
use App\Models\v3\Store as StoreModel;
|
|
|
|
class LanzuEmployeesController extends AdminController
|
|
{
|
|
/**
|
|
* Make a grid builder.
|
|
*
|
|
* @return Grid
|
|
*/
|
|
protected function grid()
|
|
{
|
|
return Grid::make(new LanzuEmployees(), function (Grid $grid) {
|
|
$grid->column('id')->sortable();
|
|
$grid->column('market_id');
|
|
$grid->column('user_id')->display(function($userId){
|
|
$item = UserModel::getUserInfo($userId,'real_name');
|
|
return empty($item) ? '' : $$item['real_name'];
|
|
});
|
|
$grid->column('store_id')->display(function($storeId){
|
|
$item = StoreModel::getStoreInfo($storeId,'real_name');
|
|
return empty($item) ? '' : $$item['real_name'];
|
|
});
|
|
|
|
$grid->column('role')->display(function($role){
|
|
return $role;
|
|
});
|
|
$grid->column('status')->select(EmployeesModel::$_STATUS);
|
|
|
|
$grid->filter(function (Grid\Filter $filter) {
|
|
$filter->equal('id');
|
|
|
|
});
|
|
$grid->model()->orderBy('id','desc');
|
|
// 每页10条
|
|
$grid->paginate(10);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Make a show builder.
|
|
*
|
|
* @param mixed $id
|
|
*
|
|
* @return Show
|
|
*/
|
|
protected function detail($id)
|
|
{
|
|
return Show::make($id, new LanzuEmployees(), function (Show $show) {
|
|
$show->field('id');
|
|
$show->field('user_id');
|
|
$show->field('store_id');
|
|
$show->field('market_id');
|
|
$show->field('role');
|
|
$show->field('status');
|
|
$show->field('note');
|
|
$show->field('created_at');
|
|
$show->field('updated_at');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Make a form builder.
|
|
*
|
|
* @return Form
|
|
*/
|
|
protected function form()
|
|
{
|
|
return Form::make(new LanzuEmployees(), function (Form $form) {
|
|
$form->display('id');
|
|
$form->text('user_id');
|
|
$form->text('store_id');
|
|
$form->text('market_id');
|
|
$form->text('role');
|
|
$form->text('status');
|
|
$form->text('note');
|
|
|
|
$form->display('created_at');
|
|
$form->display('updated_at');
|
|
});
|
|
}
|
|
}
|