ApproveController.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Admin\Actions\backstage\Pass;
  4. use App\Admin\Actions\backstage\Refuse;
  5. use App\Admin\Actions\backstage\Revoke;
  6. use App\Models\Docter;
  7. use App\Models\DocterOrganization;
  8. use App\Models\Office;
  9. use Encore\Admin\Controllers\AdminController;
  10. use Encore\Admin\Form;
  11. use Encore\Admin\Grid;
  12. use Encore\Admin\Show;
  13. class ApproveController extends AdminController
  14. {
  15. /**
  16. * Title for current resource.
  17. *
  18. * @var string
  19. */
  20. protected $title = '认证列表';
  21. /**
  22. * Make a grid builder.
  23. *
  24. * @return Grid
  25. */
  26. protected function grid()
  27. {
  28. $grid = new Grid(new DocterOrganization());
  29. $grid ->model()->where('state','>=','1');
  30. $grid->column('id', __('Id'));
  31. $grid->column('docter.id', __('医生ID'));
  32. $grid->column('docter.name', __('名字'));
  33. $grid->column('docter.sex', __('性别'))->using([0=>'未知',1=>'男',2=>'女']);
  34. $grid->column('docter.card_id', __('身份证'));
  35. $grid->column('organization.name', __('机构'));
  36. $grid->column('office.name', __('科室'));
  37. $grid->column('qualification.name', __('医生资质'));
  38. $grid->column('state', __('状态'))->using([1=>'待审核',2=>'已认证',3=>'已驳回']);
  39. $grid->actions(function ($actions) {
  40. $actions->add(new Pass());
  41. $actions->add(new Refuse());
  42. $actions->add(new Revoke());
  43. });
  44. return $grid;
  45. }
  46. /**
  47. * Make a show builder.
  48. *
  49. * @param mixed $id
  50. * @return Show
  51. */
  52. protected function detail($id)
  53. {
  54. $show = new Show(DocterOrganization::findOrFail($id));
  55. $show->field('id', __('Id'));
  56. $show->field('docter.id', __('医生ID'));
  57. $show->field('docter.name', __('名字'));
  58. $show->field('docter.sex', __('性别'))->using([0=>'未知',1=>'男',2=>'女']);
  59. $show->field('docter.card_id', __('身份证'));
  60. $show->field('organization.name', __('机构'));
  61. $show->field('office.name', __('科室'));
  62. $show->field('qualification.name', __('医生资质'));
  63. // $show->field('docter.card_photo', __('身份证正反面'))->as(function ($id){
  64. //// dd($id);
  65. // $imgs = explode(',',$id);
  66. // $html = '';
  67. // foreach ($imgs as $val){
  68. // $html .='img src="'.$val.'"';
  69. // }
  70. // return "<{$html}>";
  71. //// return json_decode($id,true);
  72. // });
  73. $show->field('docter.card_photo', __('身份证正反面'))->image();
  74. return $show;
  75. }
  76. /**
  77. * Make a form builder.
  78. *
  79. * @return Form
  80. */
  81. protected function form()
  82. {
  83. $form = new Form(new DocterOrganization());
  84. $form->number('docter_id', __('Docter id'));
  85. $form->number('organization_id', __('Organization id'));
  86. $form->number('offices_id', __('Offices id'));
  87. $form->number('qualifications_id', __('Qualifications id'));
  88. $form->number('state', __('State'));
  89. return $form;
  90. }
  91. }