Most tutorials demonstrate the simplest possible Eloquent queries. You know, the one where you do
Post::all() and move on. But, in reality, you're often writing significantly more complex queries. So what do we do, when they get too large and gross to keep in the controller? Well, we could extract to the model, we could create a repository, or we could make a single-use query class. Let me show you how; it's easy!
View the demo source for this episode on GitHub.
Published on Aug 3rd, 2016.
Understand.io is used by hundreds of Laravel developers to find and fix errors.
Sign up for a free 14-day trial now.