taxonomy_name = $model->taxonomy_name ?: 'global_label'; // default type is label }); static::addGlobalScope('taxonomy_name', function (Builder $builder) { $builder->where('taxonomy_name', '=', 'global_label'); }); } public function getSettingsAttribute($value) { return \maybe_unserialize($value); } public function setSettingsAttribute($value) { $this->attributes['settings'] = maybe_serialize($value); } }