From the course: Laravel Essential Training
Understand the MVC architecture - Laravel Tutorial
From the course: Laravel Essential Training
Understand the MVC architecture
Laravel FrameWork is largely based on the MVC architecture. MVC is a way of building a huge application by splitting it into three parts: models, views, and controllers. This makes maintaining the application easy as it grows and avoids repetition of code, along with a few other benefits. The model contains all the logic related to the application's data, like the schemas, the databases, and their fields. This is the part where you write the code to interact with the database. The view contains the user interface. All the components that the user sees on the web page and interacts with are included in the views. The controller is what connects the model and the view. It handles all the interactions between these two components. So in simpler words, the user interacts with the web page, which is the view. The controller takes the user's input from the view, uses some logic to translate that input into a request for the model, the model grabs the data from the database, interacts with it in any other way, and finally, the controller passes this data back from the model to the view for the user to see it. Once you have this basic concept in mind during the course, you will better understand why a specific block of code is added in a particular file and not elsewhere. Now let's go ahead.