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.