Procházet zdrojové kódy

后台认证页面显示

ChenWuJie před 4 roky
rodič
revize
b3d00f9154

+ 21 - 0
app/Admin/Actions/backstage/Pass.php

xqd
@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Admin\Actions\backstage;
+
+use App\Models\DocterOrganization;
+use Encore\Admin\Actions\RowAction;
+use Illuminate\Database\Eloquent\Model;
+
+class Pass extends RowAction
+{
+    public $name = '通过';
+
+    public function handle(Model $model)
+    {
+//         $model ...
+//        dd($model);
+        DocterOrganization::where('id',$model->id)->update(['state'=>2]);
+        return $this->response()->success('审核通过')->refresh();
+    }
+
+}

+ 19 - 0
app/Admin/Actions/backstage/Refuse.php

xqd
@@ -0,0 +1,19 @@
+<?php
+
+namespace App\Admin\Actions\backstage;
+use App\Models\DocterOrganization;
+use Encore\Admin\Actions\RowAction;
+use Illuminate\Database\Eloquent\Model;
+
+class Refuse extends RowAction
+{
+    public $name = '驳回';
+
+    public function handle(Model $model)
+    {
+        // $model ...
+        DocterOrganization::where('id',$model->id)->update(['state'=>3]);
+        return $this->response()->success('审核拒绝')->refresh();
+    }
+
+}

+ 19 - 0
app/Admin/Actions/backstage/Revoke.php

xqd
@@ -0,0 +1,19 @@
+<?php
+
+namespace App\Admin\Actions\backstage;
+use App\Models\DocterOrganization;
+use Encore\Admin\Actions\RowAction;
+use Illuminate\Database\Eloquent\Model;
+
+class Revoke extends RowAction
+{
+    public $name = '撤销';
+
+    public function handle(Model $model)
+    {
+        // $model ...
+        DocterOrganization::where('id',$model->id)->update(['state'=>0]);
+        return $this->response()->success('审核撤销')->refresh();
+    }
+
+}

+ 101 - 0
app/Admin/Controllers/ApproveController.php

xqd
@@ -0,0 +1,101 @@
+<?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.sex', __('性别'))->using([0=>'未知',1=>'男',2=>'女']);
+        $grid->column('docter.card_id', __('身份证'));
+        $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;
+    }
+}