 Everybody this is Brian and welcome to the fifth yeet tutorial today. We're going to be discussing the model view controller framework So just go to Google images and type in MVC and you'll get a plethora of images One of the best representations of MVC patterns is this little guy right here All right, so you've got The end user he makes a request Comes through HTTP or whatever The controller controls the flow of data, so he's requesting it through the controller The controller interfaces with a model which is just a representation of the database or the data structure, whatever it is The model returns the data structure the controller can doesn't necessarily have to manipulate the data and That data is displayed in a view and the view is what's sent back to the end user Well yee like most other frameworks is an MVC framework a model view controller framework So what we're going to be discussing in the next few tutorials are well you guessed it models controllers and views So That the nutshells MVC We're going to look at how it works together in he so let's kind of Claps this we've got our basic site here and you see we have our controllers We have our models and of course we have our views Now you notice how for controllers and models We have a single file for each one like there's a teacher controller and a teacher model Now remember the controller is simply controls the flow of information So the controller is what the request will go through So let's say you want teachers index right? It's going to go to the action index and from there it's going to say hey execute this code Which you can see is just doing a see active data provider of teachers So it's loading that model and then rendering the view index So just for this example here teachers index. Let's actually go there. So you see what I'm talking about here And if you're here, and you don't remember how to get there Just go our equal teachers because you're typing in the route This is the view right here. This is the index view. This is the exact same thing as doing Index maybe that's a little clear. So you have the teacher controller and the index view Teachers index now when we go into the code Boop see go into the code The controller is automatically appending the word action that way it knows the action is index We're going to get into that in next few tutorials when we talk about controllers in depth But for this just understand that a function is being called That function is determining what happens. It's loading this code So really it's just saying create a new see active data provider called teachers Well, that's saying load the teacher model Then it's rendering creating the view index So if you follow along here, what we're doing is the controller is creating the model So you go to the models it's loading up this teachers They're doing a search Which there's the search right here covering it of course in a future tutorial and The model is a representation of the data. I have to keep repeating that the model is not the data It is a representation of the data Anyways the controller then takes that model the data provider in this case and Sends it to the view which in this case is index. So if you go to views Notice how views there is a folder for each one rather than a single file So if we go teachers and expand that and we've already touched on this a little bit. There's multiple files So if we open index You see this is the view that's being rendered So there's not a whole lot to this like teachers and then we're creating this widget here Which we'll cover later really you just need to understand the MVC pattern and how it works And if you really want to test this out you can just type in like Hello and Couple hard returns and you can see there's like nothing there and there's hello That in a nutshell is MVC and how it works our next couple of tutorials We're going to deep dive into the model view and controller and learn exactly how they function But you really before you progress need to understand the MVC pattern as it's called If you really need to Wikipedia actually has Some pretty good information here about MVC patterns Basically the user uses a controller, but sees the view the model kind of sits in the background and manipulates and updates the data Very simple short tutorial. Just wanted to cement that concept in your mind and we'll use that going forward