The most often question I hear in Laravel is this:
"Where should I put this code logic?"
Here's a typical post from StackOverflow:
Basic Laravel is an MVC framework, it's clear what should be in Model, View and Controller. But what if you have custom logic for processing data before passing it to the view? Where should it be?
- In the same Controller method?
- Separate private Controller method?
- Static function in Model?
- Separate class, like Service?
- Or, maybe, global helper function without any class?
- Also, I've heard Repository is a widely-used pattern?
And the list goes on.
Of course, the correct answer is it depends. But depends on what?
This is what I'm gonna talk about in my upcoming online-course:
How to Structure Laravel Project
The goal is to discuss practical examples of structuring larger Laravel applications, various approaches and patterns. We will analyze existing popular open-source projects and their structure.
Take a look at the first video I've shot, analyzing a well-written open-source Akaunting project:
Important notice: this course won't be about design patterns. So fancy keywords like Singleton, Factory, Adapter, Repository etc will be used only when appropriate.
What I will try to do is focus on the practical side: folders, classes and methods, and not on how that pattern actually is called in theory. In reality, every project is actually a mix of patterns, and developers don't even know how they're called.
The course is scheduled for release until end of January 2019.
You can prepurchase the course for "Blind Bird" price with -66% discount: $19 instead of $59. Click here to enroll.
Also, if you have any ideas or questions you want me to discuss in the course, please add the comment here or email povilas@laraveldaily.com.
Feeling excited about this topic, I hope you are too!
No comments or questions yet...