Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Modelling Data1:25 with Jonathan Barrios
Learn what a "model" is and its role in the MVC framework.
The M in MVC stands for model and represents an application's knowledge,
in other words, what the application knows or its data.
Models represent data and interact with the database.
Creating, reading, updating, and deleting data, or CRUD for short.
For example, say a user visits a movie page on IMDb,
the URL is handed to the controller.
Remember, controllers handle all of the communication in the app.
The controller knows it needs some data so it talks to a particular model for
The controller doesn't know how the model does what it does.
It just says, hey model, I need information about Toy Story.
And the model doesn't know anything about how that information will be used.
For example, what the final web pages will look like.
The model doesn't know anything beyond its single function.
An application will have different models for different pieces of data.
For example, a user model with data related to users on a site,
a movie model for a movie, an actor model for actor data, and so on.
After receiving the request the model returns the data to the controller.
In the IMDb example the model hands the Toy Story data to the controller.
And the controller, as you'll see next, hands the data to the view.
You need to sign up for Treehouse in order to download course files.Sign up