瀏覽代碼

新增服务审核的开通逻辑

ChenWuJie 4 年之前
父節點
當前提交
c7245ed570

+ 20 - 0
app/Admin/Actions/Service/PassAction.php

xqd
@@ -0,0 +1,20 @@
+<?php
+
+namespace App\Admin\Actions\Service;
+
+use App\Models\Serviceapplys;
+use Encore\Admin\Actions\RowAction;
+use Illuminate\Database\Eloquent\Model;
+
+class PassAction extends RowAction
+{
+    public $name = '开通';
+
+    public function handle(Model $model)
+    {
+        // $model ...
+        Serviceapplys::where('id',$this->row->id)->update(['status'=>2]);
+        return $this->response()->success('开通成功')->refresh();
+    }
+
+}

+ 6 - 0
app/Admin/Controllers/ServiceManagement/ServiceController.php

xqd xqd
@@ -2,7 +2,9 @@
 
 namespace App\Admin\Controllers\ServiceManagement;
 
+use App\Admin\Actions\backstage\Pass;
 use App\Admin\Actions\Service\ApplysAction;
+use App\Admin\Actions\Service\PassAction;
 use App\Admin\Actions\Service\RefuseAction;
 use App\Admin\Actions\Service\RevokeAction;
 use App\Models\Docter;
@@ -88,6 +90,10 @@ class ServiceController extends AdminController
             {
                 $actions->add(new RevokeAction());
             }
+            if ($actions->row->status == 3)
+            {
+                $actions->add(new PassAction());
+            }
         });
         return $grid;
     }