|
@@ -60,7 +60,6 @@ class SalesOrder extends Model
|
|
];
|
|
];
|
|
public static $user = [];
|
|
public static $user = [];
|
|
public static $search = [];
|
|
public static $search = [];
|
|
- public static $is_search = false;
|
|
|
|
const range_function = 'salesOrderRange';
|
|
const range_function = 'salesOrderRange';
|
|
|
|
|
|
public function __construct(array $attributes = [])
|
|
public function __construct(array $attributes = [])
|
|
@@ -69,15 +68,8 @@ class SalesOrder extends Model
|
|
self::$user = $attributes['userData'];
|
|
self::$user = $attributes['userData'];
|
|
self::$user['range_function'] = self::range_function;
|
|
self::$user['range_function'] = self::range_function;
|
|
self::$search = $attributes['search'] ?? [];
|
|
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));
|
|
static::addGlobalScope(new DepartmentScope(self::$user, self::$search));
|
|
}
|
|
}
|
|
|
|
+ parent::__construct($attributes);
|
|
}
|
|
}
|
|
}
|
|
}
|