cqpCow 1 năm trước cách đây
mục cha
commit
ffc49ddb47
1 tập tin đã thay đổi với 1 bổ sung9 xóa
  1. 1 9
      app/Model/BasicType.php

+ 1 - 9
app/Model/BasicType.php

@@ -42,22 +42,14 @@ class BasicType 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 TopDepartmentScope(self::$user, self::$search));
         }
+        parent::__construct($attributes);
     }
 }