|
@@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
class Construction extends Model
|
|
|
{
|
|
|
-// protected $fillable = ['userData'];
|
|
|
protected $guarded = [];
|
|
|
protected $table = "construction"; //指定表
|
|
|
const CREATED_AT = 'crt_time';
|
|
@@ -34,7 +33,6 @@ class Construction extends Model
|
|
|
|
|
|
public static $user = [];
|
|
|
public static $search = [];
|
|
|
- public static $is_search = false;
|
|
|
const range_function = 'constructionRange';
|
|
|
|
|
|
public function __construct(array $attributes = [])
|
|
@@ -43,15 +41,8 @@ class Construction 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);
|
|
|
}
|
|
|
}
|