Closed
Description
Given the following model:
<?php
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
use Jenssegers\Mongodb\Eloquent\Builder;
class Scoped extends Eloquent
{
protected $connection = 'mongodb';
protected $collection = 'scoped';
protected $fillable = ['name', 'favorite'];
protected static function boot()
{
parent::boot();
static::addGlobalScope('favorite', function (Builder $builder) {
$builder->where('favorite', true);
});
}
}
If I run the following:
Scoped::query()->update(['name' => 'Johnny']);
It should only update models where favorite
is true
, because of the favorite
scope. However, it updates all models.
Metadata
Metadata
Assignees
Labels
No labels