Eloquent Global Scopes
Published on by Eric L. Barnes
Eloquent global scopes have just been added to the documentation:
Sometimes you may wish to define a scope that applies to all queries performed on a model. In essence, this is how Eloquent’s own “soft delete” feature works. Global scopes are defined using a combination of PHP traits and an implementation of IlluminateDatabaseEloquentScopeInterface.
Eric is the creator of Laravel News and has been covering Laravel since 2012.