Laravel Eloquent Queries are the Best one. We are used. Eg: Post::all(); this returns all records. But we need to build our custom queries and use that where we want. So here Laravel provides a solution. That call Model Scope.
If you are writing eloquent queries in your Laravel project and write the same logic in your queries repeatedly, then query scopes might be of use to you. Laravel provides a solution for wrapping your conditions into a readable and reusable statement called Scopes.
Laravel has two scopes: Local Scope and Global Scope.
This article only discusses Local Scopes.