Join 25,000+ Laravel Developers and join the free Laravel Newsletter
Laravel / July 03, 2014

Eloquent Global Scopes

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.

This appeared first on Laravel News
Laravel News Partners

Newsletter

Join the weekly newsletter and never miss out on new tips, tutorials, and more.