cqpCow 1 سال پیش
والد
کامیت
ba1ea3d79c
1فایلهای تغییر یافته به همراه1 افزوده شده و 9 حذف شده
  1. 1 9
      app/Model/Product.php

+ 1 - 9
app/Model/Product.php

@@ -24,7 +24,6 @@ class Product extends Model
 
     public static $user = [];
     public static $search = [];
-    public static $is_search = false;
     const range_function = 'productRange';
 
     public function __construct(array $attributes = [])
@@ -33,15 +32,8 @@ class Product extends Model
             self::$user = $attributes['userData'];
             self::$user['range_function'] = self::range_function;
             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);
     }
 }