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

+ 1 - 9
app/Model/InvoiceOrder.php

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