cqpCow 1 年之前
父节点
当前提交
f1ff5765c1
共有 1 个文件被更改,包括 1 次插入9 次删除
  1. 1 9
      app/Model/Storehouse.php

+ 1 - 9
app/Model/Storehouse.php

@@ -21,22 +21,14 @@ class Storehouse extends Model
 
     public static $user = [];
     public static $search = [];
-    public static $is_search = false;
 
     public function __construct(array $attributes = [])
     {
         if(! empty($attributes['userData'])) {
             self::$user = $attributes['userData'];
             self::$search = $attributes['search'];
-            self::$is_search = true;
-        }
-        parent::__construct($attributes);
-    }
-
-    protected static function boot(){
-        parent::boot();
-        if(self::$is_search){
             static::addGlobalScope(new DepartmentScope(self::$user, self::$search));
         }
+        parent::__construct($attributes);
     }
 }