You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Schema::create('my_models', function (Blueprint $table) {
$table->increments('id');
$table->integer('parent_id');
$table->morphs('owner');
});
...
class MyModel extends Model {
public function parent() { // Simple belongsTo relation
$relation = $this->belongsTo(Parent::class);
$relation->withoutGlobalScopes(); // Works fine
return $relation;
}
public function owner() { // Simple morphTo relation
$relation = $this->morphTo();
$relation->withoutGlobalScopes(); // No effect
return $relation;
}
}
...
$model = MyModel::with('parent', 'owner')->first();
assert(!is_null($model->parent); // ok
assert(!is_null($model->owner); // fails if owner was filtered by any global scope
The text was updated successfully, but these errors were encountered:
Description:
There is no way to omit global scopes for morphTo relation.
Also the same problem is described here: https://laracasts.com/index.php/discuss/channels/general-discussion/remove-global-scope-on-morphto
Steps To Reproduce:
The text was updated successfully, but these errors were encountered: