wesmiler 5 dni temu
rodzic
commit
282706c8b2
1 zmienionych plików z 6 dodań i 0 usunięć
  1. 6 0
      app/Services/Common/GoodsCategoryService.php

+ 6 - 0
app/Services/Common/GoodsCategoryService.php

@@ -299,11 +299,17 @@ class GoodsCategoryService extends BaseService
     public function options()
     {
         $type = request()->post('type',0);
+        $kw = request()->post('kw','');
         $map = ['type'=>$type,'status'=>1,'mark'=>1];
         if($type<=0){
            unset($map['type']);
         }
         $list = $this->model->where($map)
+            ->where(function ($query) use($kw){
+                if($kw){
+                    $query->where('name','like',"%{$kw}%");
+                }
+            })
             ->orderBy('sort', 'desc')
             ->orderBy('id', 'asc')
             ->select(['id', 'name','type', 'pid', 'icon'])