1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- namespace App\Admin\Controllers\UserManagement\DocterManagement;
- use App\Admin\Actions\backstage\Docters\AddLabel;
- use App\Admin\Actions\backstage\Docters\DelLabel;
- use App\Admin\Actions\backstage\Docters\LabelManagement;
- use App\Admin\Actions\backstage\Docters\SignUp;
- use App\Admin\Actions\backstage\Docters\Team;
- use App\Models\Docter;
- use App\Models\DocterLabel;
- use App\Models\DocterOrganization;
- use App\Models\Organization;
- use App\Models\User;
- use Encore\Admin\Controllers\AdminController;
- use Encore\Admin\Form;
- use Encore\Admin\Grid;
- use Encore\Admin\Show;
- class DoctorManagementController extends AdminController
- {
- /**
- * Title for current resource.
- *
- * @var string
- */
- protected $title = '医生列表';
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- $grid = new Grid(new Docter());
- $grid->disableCreateButton();
- $grid->filter(function ($filter){
- $filter->disableIdFilter();
- $filter->like('name','昵称');
- $filter->equal('status','工作状态')->select([
- 0 => '禁用',
- 1 => '启用',
- ]);
- });
- $grid->actions(function ($actions) {
- // 去掉编辑
- $actions->disableEdit();
- // 去掉查看
- $actions->disableView();
- //签约管理
- $actions->add(new SignUp());
- //团队管理
- $actions->add(new Team());
- //标签管理
- $actions->add(new LabelManagement());
- });
- $grid->column('id', __('Id'))->sortable();
- $grid->column('name', __('姓名'));
- $grid->column('avatar', __('头像'))->image('',50,50);
- $grid->column('score', __('评分'));
- $grid->column('service_persons', __('服务人数'));
- $states = [
- 'on' => ['value' => 1, 'text' => '启用', 'color' => 'primary'],
- 'off' => ['value' => 0, 'text' => '禁用', 'color' => 'danger'],
- ];
- $grid->column('status', __('工作状态'))->switch($states);
- $grid->column('is_then', __('认证状态'))->using([0=>'未认证',1=>'已认证']);
- $grid->column('label', __('标签'))->display(function ($label){
- $label_value = DocterLabel::whereIn('id',$label)->pluck('label_name');
- return $label_value;
- })->label('info');
- return $grid;
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- * @return Show
- */
- protected function detail($id)
- {
- $show = new Show(Docter::findOrFail($id));
- return $show;
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- $form = new Form(new Docter());
- $form->switch('status', __('状态'));
- return $form;
- }
- }
|