In Laravel with the use of scope in Model, you can save time of writing the same script in multiple places in your project.
For example, selecting records based on their status – active/inactive/suspended.
The query scope methods are prefixed by scope.
In this tutorial, I show how you can create a reusable query using Query scope in Laravel 9.