123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
- namespace App\Admin\Controllers;
- use App\Admin\Actions\backstage\Pass;
- use App\Admin\Actions\backstage\Refuse;
- use App\Admin\Actions\backstage\Revoke;
- use App\Models\Docter;
- use App\Models\DocterOrganization;
- use App\Models\Office;
- use Encore\Admin\Controllers\AdminController;
- use Encore\Admin\Form;
- use Encore\Admin\Grid;
- use Encore\Admin\Show;
- class ApproveController extends AdminController
- {
- /**
- * Title for current resource.
- *
- * @var string
- */
- protected $title = '认证列表';
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- $grid = new Grid(new DocterOrganization());
- $grid ->model()->where('state','>=','1');
- $grid->column('id', __('Id'));
- $grid->column('docter.id', __('医生ID'));
- $grid->column('docter.name', __('医生姓名'));
- $grid->column('docter.avatar', __('医生头像'))->image(50,50);
- $grid->column('docter.sex', __('性别'))->using([0=>'未知',1=>'男',2=>'女']);
- $grid->column('organization.name', __('机构'));
- $grid->column('office.name', __('科室'));
- $grid->column('qualification.name', __('医生资质'));
- $grid->column('state', __('状态'))->using([1=>'待审核',2=>'已认证',3=>'已驳回']);
- $grid->actions(function ($actions) {
- //通过申请
- $actions->add(new Pass());
- //驳回申请
- $actions->add(new Refuse());
- //撤销申请
- $actions->add(new Revoke());
- });
- return $grid;
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- * @return Show
- */
- protected function detail($id)
- {
- $show = new Show(DocterOrganization::findOrFail($id));
- $show->field('id', __('Id'));
- $show->field('docter.id', __('医生ID'));
- $show->field('docter.name', __('名字'));
- $show->field('docter.sex', __('性别'))->using([0=>'未知',1=>'男',2=>'女']);
- $show->field('docter.card_id', __('身份证'));
- $show->field('organization.name', __('机构'));
- $show->field('office.name', __('科室'));
- $show->field('qualification.name', __('医生资质'));
- // $show->field('docter.card_photo', __('身份证正反面'))->as(function ($id){
- //// dd($id);
- // $imgs = explode(',',$id);
- // $html = '';
- // foreach ($imgs as $val){
- // $html .='img src="'.$val.'"';
- // }
- // return "<{$html}>";
- //// return json_decode($id,true);
- // });
- $show->field('docter.card_photo', __('身份证正反面'))->image();
- return $show;
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- $form = new Form(new DocterOrganization());
- $form->number('docter_id', __('Docter id'));
- $form->number('organization_id', __('Organization id'));
- $form->number('offices_id', __('Offices id'));
- $form->number('qualifications_id', __('Qualifications id'));
- $form->number('state', __('State'));
- return $form;
- }
- }
|