Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMichael Cook
Full Stack JavaScript Techdegree Graduate 28,975 PointsWhat is the model in a Slim app and where does it go?
I am totally confused. The "MVC" course for PHP here doesn't even talk at all about the model, and I am very unclear about this. I am building a blog with Slim, and I am going to have methods that access the database, but I know that the data is supposed to be a separate layer from the business logic. What exactly is the model in an MVC application, and where do I put it? Or are there multiple models? As you can tell, I am totally confused and really need some help understanding this. Thanks.
Michael Cook
Full Stack JavaScript Techdegree Graduate 28,975 PointsThanks again Pascal for your encouraging answers! I think I am too focused on learning the "correct" way to do things. Slim doesn't force one correct way of setting up your own classes, so the right way is just however you think it works best for the project.
Pascal Breitrück
Courses Plus Student 3,206 PointsYou got it ;D
Pascal Breitrück
Courses Plus Student 3,206 PointsPascal Breitrück
Courses Plus Student 3,206 PointsHey Micahel, me again ;D ;D ;D ;D , Don't look for the right structure you will lost so much time. If you have problems with the structure of the app then take a step back. MVC is just a design pattern . Try to understand this pattern and the rest will come by itself.
https://www.sitepoint.com/the-mvc-pattern-and-php-1/
https://www.sitepoint.com/the-mvc-pattern-and-php-2/
https://github.com/kamranahmedse/design-patterns-for-humans
https://github.com/domnikl/DesignPatternsPHP
A good way to understand the Pattern ist to look at the big players Laravel , Symfony, Zend.
https://symfonycasts.com/
https://laracasts.com/
Believe me, there you learn what you want . After some progress Slim will be soooooo easy for you because you understand the concepts.
Greets Pascal
Ps. with https://education.github.com/pack you get symfonycasts 3month for free ;D