cqpCow hai 1 ano
pai
achega
f1ff5765c1
Modificáronse 1 ficheiros con 1 adicións e 9 borrados
  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);
     }
 }