瀏覽代碼

错误代码

ChenWuJie 4 年之前
父節點
當前提交
ab4c9e4d9b
共有 2 個文件被更改,包括 9 次插入0 次删除
  1. 5 0
      app/Admin/Controllers/ServiceManagement/ServiceController.php
  2. 4 0
      app/Models/Serviceapplys.php

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

xqd
@@ -71,6 +71,11 @@ class ServiceController extends AdminController
         $grid->filter(function ($filter){
             $filter->equal('service_type','服务类型')->select([1 => '图文', 2 => '电话', 3 => '问诊']);
             $filter->equal('status','服务类型')->select([1=>'待审核',2 =>'已通过 ',3=>'已拒绝']);
+            $filter->where(function ($query) {
+                $query->whereHas('organization',function ($query){
+                    $query->where('name','like',"%{$this->input}%");
+                });
+            },'机构名');
         });
         $grid->actions(function ($actions) {
             $actions->disableEdit();

+ 4 - 0
app/Models/Serviceapplys.php

xqd
@@ -21,6 +21,10 @@ class Serviceapplys extends Model
     {
         return $this->hasMany(DocterOrganization::class,'docter_id','docter_id');
     }
+    public function organization()
+    {
+        return $this->belongsToMany('App\Models\Organization','docter_organization','docter_id','id');
+    }
 //    private static $_post_type =[
 //        1 => '图文',
 //        2 => '电话',