protected $_enableCreation = true;
protected $_enableRevisions = true;
protected $_enableBulk = true;
- protected static $_ownerAttribute = 'owner';
+ protected static $_ownerAttribute = null;
protected $_syncDbSchema = true;
public static function boot()
{
parent::boot();
-
- static::addGlobalScope('userfilter', function (Builder $builder) {
+ static::addGlobalScope('ownerclause', function (Builder $builder) {
static::addOwnerClause($builder);
});
}
public static function addOwnerClause(Builder $builder)
{
- $builder->where(static::$_ownerAttribute, backpack_user()->id);
}
public function __construct(array $attributes = [])
$cast = $field->getAttribute('cast', false);
if ($cast !== false) {
if (is_array($cast)) {
- foreach ($cast as $name => $type) {
- $this->casts[$name] = $type;
+ foreach ($cast as $n => $t) {
+ $this->casts[$n] = $t;
}
} else {
$this->casts[$field->getAttribute('name')] = $cast;