9 changed files with 295 additions and 28 deletions
-
95app/Admin/Controllers/v3/LanzuEmployeesController.php
-
110app/Admin/Controllers/v3/UserController.php
-
16app/Admin/Repositories/v3/User.php
-
2app/Admin/routes.php
-
10app/Models/v3/LanzuEmployees.php
-
19app/Models/v3/User.php
-
42config/role.php
-
4resources/lang/zh-CN/lanzu-employees.php
-
25resources/lang/zh-CN/user.php
@ -0,0 +1,110 @@ |
|||
<?php |
|||
|
|||
namespace App\Admin\Controllers\v3; |
|||
|
|||
use App\Admin\Repositories\v3\User; |
|||
use Dcat\Admin\Form; |
|||
use Dcat\Admin\Grid; |
|||
use Dcat\Admin\Show; |
|||
use Dcat\Admin\Controllers\AdminController; |
|||
use App\Models\v3\User as UserModel; |
|||
|
|||
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('avatar')->image('',50); |
|||
$grid->column('nick_name'); |
|||
$grid->column('openid'); |
|||
$grid->column('unionid'); |
|||
$grid->column('real_name')->editable(); |
|||
$grid->column('tel'); |
|||
$grid->column('gender_text'); |
|||
$grid->column('status')->using(UserModel::$_STATUS)->label(config('label.status_label')); |
|||
|
|||
$grid->filter(function (Grid\Filter $filter) { |
|||
$filter->equal('id'); |
|||
$filter->like('nick_name'); |
|||
$filter->like('real_name'); |
|||
}); |
|||
$grid->model()->orderBy('id','desc'); |
|||
// 每页10条
|
|||
$grid->paginate(10); |
|||
$grid->disableCreateButton(); |
|||
$grid->disableDeleteButton(); |
|||
$grid->disableEditButton(); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 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('nick_name'); |
|||
$show->field('avatar')->image(); |
|||
$show->field('openid'); |
|||
$show->field('real_name'); |
|||
$show->field('tel'); |
|||
$show->field('unionid'); |
|||
$show->field('status'); |
|||
$show->field('country'); |
|||
$show->field('province'); |
|||
$show->field('city'); |
|||
$show->field('gender'); |
|||
$show->field('language'); |
|||
$show->field('created_at'); |
|||
$show->field('updated_at'); |
|||
|
|||
$show->panel()->tools(function ($tools) { |
|||
$tools->disableEdit(); |
|||
// $tools->disableList();
|
|||
$tools->disableDelete(); |
|||
// 显示快捷编辑按钮
|
|||
// $tools->showQuickEdit();
|
|||
}); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Make a form builder. |
|||
* |
|||
* @return Form |
|||
*/ |
|||
protected function form() |
|||
{ |
|||
return Form::make(new User(), function (Form $form) { |
|||
$form->hidden('id'); |
|||
$form->text('nick_name'); |
|||
$form->image('avatar'); |
|||
$form->text('openid'); |
|||
$form->text('real_name'); |
|||
$form->tel('tel'); |
|||
$form->text('unionid'); |
|||
$form->text('status'); |
|||
$form->text('country'); |
|||
$form->text('province'); |
|||
$form->text('city'); |
|||
$form->radio('gender')->options(UserModel::$_GENDER); |
|||
$form->text('language'); |
|||
|
|||
$form->disableResetButton(); |
|||
$form->disableViewCheck(); |
|||
$form->disableEditingCheck(); |
|||
$form->disableCreatingCheck(); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
<?php |
|||
|
|||
namespace App\Admin\Repositories\v3; |
|||
|
|||
use App\Models\v3\User as Model; |
|||
use Dcat\Admin\Repositories\EloquentRepository; |
|||
|
|||
class User extends EloquentRepository |
|||
{ |
|||
/** |
|||
* Model. |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $eloquentClass = Model::class; |
|||
} |
|||
@ -0,0 +1,42 @@ |
|||
<?php |
|||
/** |
|||
* 懒族员工角色 |
|||
*/ |
|||
return [ |
|||
'position'=>[ |
|||
1 => '董事长', |
|||
2 => '总经理', |
|||
3 => '人力资源总监', |
|||
4 => 'CTO', |
|||
5 => '财务经理', |
|||
6 => '运营总监', |
|||
7 => '招商总监', |
|||
8 => 'PHP研发主管', |
|||
9 => '迁江智慧商城主管', |
|||
10 => '拓展部主管', |
|||
|
|||
11 => '拓展部副主管', |
|||
12 => '拓展部经理', |
|||
13 => '运维部经理', |
|||
14 => '产品主管', |
|||
15 => '策划经理', |
|||
16 => '运维部副经理', |
|||
17 => '新媒体运营', |
|||
18 => '平面设计师', |
|||
19 => 'UI设计师', |
|||
20 => '前端开发工程师', |
|||
|
|||
21 => 'PHP研发工程师', |
|||
22 => '测试工程师', |
|||
23 => '招商经理', |
|||
24 => '服务站管理员', |
|||
25 => '运维专员', |
|||
26 => '拓展经理', |
|||
27 => '行政助理', |
|||
28 => '出纳', |
|||
|
|||
29 => '骑手', |
|||
30 => '服务专员', |
|||
|
|||
] |
|||
]; |
|||
@ -0,0 +1,25 @@ |
|||
<?php |
|||
return [ |
|||
'labels' => [ |
|||
'User' => '微信用户', |
|||
'user' => '微信用户', |
|||
], |
|||
'fields' => [ |
|||
'nick_name' => '昵称', |
|||
'avatar' => '微信头像', |
|||
'openid' => '微信小程序openid', |
|||
'real_name' => '真实姓名', |
|||
'tel' => '电话号码', |
|||
'unionid' => '微信小程序unionid', |
|||
'status' => '状态', |
|||
'status_text' => '状态', |
|||
'country' => '国家', |
|||
'province' => '省份', |
|||
'city' => '城市', |
|||
'gender' => '性别', |
|||
'gender_text' => '性别', |
|||
'language' => '语言', |
|||
], |
|||
'options' => [ |
|||
], |
|||
]; |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue