cqpCow 1 年之前
父節點
當前提交
0b77e67b69
共有 1 個文件被更改,包括 1 次插入9 次删除
  1. 1 9
      app/Model/PurchaseOrder.php

+ 1 - 9
app/Model/PurchaseOrder.php

@@ -33,7 +33,6 @@ class PurchaseOrder extends Model
 
     public static $user = [];
     public static $search = [];
-    public static $is_search = false;
     const range_function = 'purchaseRange';
 
     public function __construct(array $attributes = [])
@@ -42,15 +41,8 @@ class PurchaseOrder 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);
     }
 }