DoctorManagementController.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Admin\Actions\backstage\Docters\SignUp;
  4. use App\Models\Docter;
  5. use App\Models\DocterOrganization;
  6. use App\Models\Organization;
  7. use App\Models\User;
  8. use Encore\Admin\Controllers\AdminController;
  9. use Encore\Admin\Form;
  10. use Encore\Admin\Grid;
  11. use Encore\Admin\Show;
  12. class DoctorManagementController extends AdminController
  13. {
  14. /**
  15. * Title for current resource.
  16. *
  17. * @var string
  18. */
  19. protected $title = '医生列表';
  20. /**
  21. * Make a grid builder.
  22. *
  23. * @return Grid
  24. */
  25. protected function grid()
  26. {
  27. $grid = new Grid(new Docter());
  28. $grid->filter(function ($filter){
  29. $filter->disableIdFilter();
  30. $filter->like('name','昵称');
  31. $filter->equal('status','工作状态')->select([
  32. 0 => '禁用',
  33. 1 => '启用',
  34. ]);
  35. });
  36. $grid->actions(function ($actions) {
  37. // 去掉编辑
  38. $actions->disableEdit();
  39. // 去掉查看
  40. $actions->disableView();
  41. $actions->add(new SignUp());
  42. });
  43. $grid->column('id', __('Id'))->sortable();
  44. $grid->column('name', __('姓名'));
  45. $grid->column('avatar', __('头像'))->image('',50,50);
  46. $grid->column('score', __('评分'));
  47. $grid->column('service_persons', __('服务人数'));
  48. $states = [
  49. 'on' => ['value' => 1, 'text' => '启用', 'color' => 'primary'],
  50. 'off' => ['value' => 0, 'text' => '禁用', 'color' => 'danger'],
  51. ];
  52. $grid->column('status', __('工作状态'))->switch($states);
  53. $grid->column('is_then', __('认证状态'))->using([0=>'未认证',1=>'已认证']);
  54. $grid->column('label', __('标签'))->label('info');
  55. return $grid;
  56. }
  57. /**
  58. * Make a show builder.
  59. *
  60. * @param mixed $id
  61. * @return Show
  62. */
  63. protected function detail($id)
  64. {
  65. $show = new Show(Docter::findOrFail($id));
  66. $show->field('id', __('Id'));
  67. $show->field('type', __('Type'));
  68. $show->field('name', __('Name'));
  69. $show->field('phone', __('Phone'));
  70. $show->field('sex', __('Sex'));
  71. $show->field('birthday', __('Birthday'));
  72. $show->field('avatar', __('Avatar'));
  73. $show->field('status', __('Status'));
  74. $show->field('label', __('Label'));
  75. $show->field('sign', __('Sign'));
  76. $show->field('intro', __('Intro'));
  77. $show->field('office_id', __('Office id'));
  78. $show->field('qualification_id', __('Qualification id'));
  79. $show->field('score', __('Score'));
  80. $show->field('service_persons', __('Service persons'));
  81. $show->field('eva_num', __('Eva num'));
  82. $show->field('service_days', __('Service days'));
  83. $show->field('phone_minutes', __('Phone minutes'));
  84. $show->field('chat_price', __('Chat price'));
  85. $show->field('phone_price', __('Phone price'));
  86. $show->field('appoint_price', __('Appoint price'));
  87. $show->field('is_chat', __('Is chat'));
  88. $show->field('is_phone', __('Is phone'));
  89. $show->field('is_appoint', __('Is appoint'));
  90. $show->field('latitude', __('Latitude'));
  91. $show->field('longitude', __('Longitude'));
  92. $show->field('created_at', __('Created at'));
  93. $show->field('updated_at', __('Updated at'));
  94. $show->field('user_id', __('User id'));
  95. $show->field('password', __('Password'));
  96. $show->field('is_then', __('Is then'));
  97. $show->field('practice', __('Practice'));
  98. $show->field('card_photo', __('Card photo'));
  99. $show->field('is_quail', __('Is quail'));
  100. $show->field('card_id', __('Card id'));
  101. $show->field('receiving_time', __('Receiving time'));
  102. return $show;
  103. }
  104. /**
  105. * Make a form builder.
  106. *
  107. * @return Form
  108. */
  109. protected function form()
  110. {
  111. $form = new Form(new Docter());
  112. $form->switch('status', __('状态'));
  113. return $form;
  114. }
  115. }