 Hello, this is Christian. This is a video three of the Laravel project. And this video would look at just up to some of the key components of a Laravel project. So it's important to understand where things are, how all these components are connected together in a Laravel application so you can navigate around very easily. So first of all, I want to go back and make sure that my application is running. If it's not, make sure you do that first. So go back to my Hello Laravel project. PHP, artisan, and then serve. And it should be running so I can close this for now and go to my terminal, my browser, and refresh. It should be running for 8,000. OK, so here again, this is the index page. If I go and type in here slash, that's the root directory. If I type in index.php, you can see it's the same thing. So where is this file exist? That's what the question you should ask yourself, right? How does it know to load this file? So let's take a look at what it looks like behind the scene. So back here, you can see again, in the Laravel application, you have about 11 folders here. The way things work is that when you launch the browser, you go to that URL, that port number 8,000. It's going to look inside the public folder here, right? So this is public facing, which is just a root directory of your public server, like you launch on a server, right? So public facing or client facing, the rest are in the backend. So most of your time, you spend using not in the public, but at the backend. So anyway, the public facing here, you can see there's a file called index.php. And I mentioned earlier that if you want to add images or any media content to your web page on the front end, you need to put it inside the public directory here. So the CSS, which we created earlier, and any images in 1.0, all right? So that is what this index.php is. And just to make sure it does work, what if I go and rename it? If I rename it to, I don't know, index2, right? So index2 has been changed. Now I go back to the browser and refresh the page. Well, guess what happens? It fails, right? And what if I go back and just go to the root directory? Same thing, it fails. It says, cannot find this file here. Doesn't exist. Or because of this. And here is some clue, right? This directory, this is my project here. If you go to the render level frameworks SRC, eliminate foundation resources server.php, that is where you will find that information, OK? So let's see if you go there and see what happens. So back here in the vendor, under the, I think, Laravel framework, SRC, eliminate, it's already in there. So all these are under the eliminate folder. Under the foundation, which is the foundation of the framework, go into the resources and there is the server.php. And this is where the file is. So as you can see, it requires this file called index.php. And that is that file we just mentioned earlier up here. That is this file. Let me open this. This is in the public folder called index here. So since I changed index2, if I change this to index2 and here, normally you don't do this unless you really want to. So just be cautious. If I change index2, it matches my file, which I call it here to go back to the browser and refresh the server. And there it is. So now it's index2 as opposed to index. If I type in index, it's not going to find it. As you can see, so 404. But if I call it index2, then that is the file. So if you want to call index2, some people call it index and call it default, some home, whatever. That's up to you. But again, what I missed with this, I just tell you where things are. So this is what it uses to bootstrap the application to that front end. So usually you don't go in here and change things. So let's go back and rename it back to index2. I mean, just index. So it goes in here. Loads all over here for some of the vendor files. And then it bootstraps the application and then sends the request to this front end and then terminates this process. So that is important. Now in here, I have a CSS folder I created earlier. I also imported some CSS in here already. I'm going to use that for the next video. We're going to add some HTML. So make sure you put that there. I will also share this with you if you need it. And again, this is the front end. How do I know that? Well, you can test it. Go in here and create a file called about.html. Very simple. And do the emit here. Create a really simple application here. We'll just call it. Let me make it big. About. All right, so here we go. Save this file. Go back to the browser and type in here about.html. And boom, there it is, right? So this is the front end. And the other is the back end. So you can see why that Laravel is a full-fledged, full-stack framework, right? You can build all your front end here and at the same time, do all your back end here the same directory here. Same project, really. So really useful, really powerful for do this stuff, which is also a really good, I guess, source or partnership with a view where you can add your view code, that's the view, it could be Angular 8, it doesn't matter, React doesn't matter. On the front end, interact with the back end, okay? So very, very powerful. I'll leave this here for now. I wanna show something really quick. Okay, so that's the front end. So the back end are, let me close this. Most of the times you will spend your time inside the routes folder. It's called the web.php. That's when you create all your routes. We saw this earlier. Now in the previous version, I think it's called web, I mean, routes.php maybe, but it doesn't matter. You can change it if you want to. Laravel is made to be flexible. That means if you don't like the way it's structured, you can actually change it if you know how to do that. So where is this file being called from? How do we know where this one is? If you go to the app folder up here, under the HTTP protocol, no, not under here. Yeah, under HTTP protocol, because using everything is HTTP. No, not here, something different later. And the providers, I'm sorry, the providers here, there is a route service provider.php. Inside here, you will see that there are two groups of routes, or we call this part of the middle way, right? There is one called the API, and one is for the web. We'll talk about this later about this prefix, things like that, and so forth. But look at the web here. This is where the file is. Route slash web.php. This file is this file right here, okay? How do we know that? Again, how do you know it's working? You can change it for either here or here. So if I go to the web down here and change it to, say, I don't know, webX, right? Change that, go to your site and refresh. This is okay because in the front end, the back end, you'll see that it's not gonna work. So there's an error saying, hey, I can't find this, web.php, where'd it go, right? Okay, so then that is where it's hooked with that one. So if you don't like to be called, you know, web, you can call it routes. If you're from other application, they usually call it routes because it's more common to be that way. I'm not sure why they change it to web. I think I like your routes better. So if you like your routes, change that here, and also change that to routes. So go here again. Routes.php matches the routes here and the name could be just called web as a matter, okay? Now if we go back to the browser and refresh the page and everything just come right back because this index is no longer called index two, you just call index. So boom, there it is. Okay, so we got that, right? Taking care of, so I'm gonna go back and just revert it back to just the web. Okay, not to confuse you too much, okay? So that's where it's being created and called from. All right, so again, your routes are being here. You don't have to create all your routes here as you build your applications go really, really huge and you can have a lot of APIs in here. So when that happens, you need to break them out into separate files and import them back and exporting all those stuff. Maybe that's the future, okay? So that's that. Now, the other one is, I mentioned earlier is the HTTP and inside here you have one photo call controllers. This is where we manage and create our own controllers. So you have like a controller for a home controller, user controller, you have product controller, admin controller, whatever. What is a controller? Well, it's really contains some mainly functions that process some logic for your application. So instead of doing everything in the web API here, you can manage that by moving all different features, if you will, to a different controller instead of filling this out with all the get, put, post and on the same page here. So we'll do that later. I will put a class in here. We create our controller, not inside this file, but you have your own separate file. We call it home.php or something like that. We'll do that later, okay? So your controller will be inside this controller folder. Again, you don't have to put it here. You can put it somewhere else if you want to, but again, why do you want to break that if it's already been built for you, okay? So just keep it as is, all right? So that's the controller. We're not gonna do any of the middleware as far as I'm concerned, maybe not yet in a way. And then the models folder, okay? This is where your models live. So again, the model, the view we looked at already, view and controller. So the models, by default, you have one file called user.php. And this is a file. It's just so common that a lot of it will create for you. And you can use this to create a database of users so that you can authenticate them to log onto your site. So you can hide, you know, content, right? Based on a user login stuff. So this is a sample one here. Later on, when we work with databases, you can come here and create your own database code here. So in this approach is usually referred to as the code approach or code first approach as opposed to the data first approach when you create this type of framework. It's also very common in other languages as well and other frameworks like .NET, for example. You have the entity framework in .NET where you can create your databases using just code, right? And if you create your coded class, you can name all your fields because, again, the class is mapped directly to a table, right? So the data fields are actually the fields inside a class as well. And so when you create your class of tables or data in here, you can then run the migration process to generate your database for you automatically without having you to do anything in the database system, okay? And this is the way to go if you are working on the team where you have multiple developers and they want to share the same database on their end. So otherwise you have to go into manually create your database, you know, look at the code and, okay, I need this many hundred fields, that's a lot of work. So using this code first approach, it's just very fast to do that for you. I can quickly generate a database within seconds, right? So that is a pretty forward to go. And we'll be using this as well for this model. Again, we'll talk about models. It usually refers to database or data systems, right? It doesn't have to be, it just be any data, right? Data source, it could be a string file, it could be JSON text, file, it could be just a variable you store inside the data and pass that around, right? That's what the data is, okay? So we'll be creating some data in here as well. The, let's see, I think that's pretty much it I want to talk about. And then finally before I end this video is inside the views, okay? So notice here in the resources folder, you have a CSS and there's a JS folder, okay? We're not gonna use this in here. If you want to access CSS and add it to your site, make sure again, you put inside the public directory here, okay? So in here, most of the time, you'll be spending inside the views folder here and you'll be creating a lot of views. We call these templates, okay? So here is the welcome blade file. This is a full-fledged HTML file. World PHP file but has a lot of HTML code. Blade syntax look is already, and as you can see, CSS fonts can be linked here. I put a kind of, you know, collapsed as you can see more. And then down here, we have the body of your HTML page, some, you know, syntax here again, a blade syntax. There is also a conflict, especially if you are integrating both blade syntax and back in front-end syntax, like for example, some other front-end, also use the add symbol. If that's the case that you want to put, you have to figure this out. And there's a way to do that again. I'm going a little bit of myself here, but I just want to show you that one, okay? So this is the welcome page. That's what you saw on the browser. And all your syntax, all your blades file should be inside this views folder, okay? Again, does it have to be views? No, you can change it. It just, again, it's in the views folder. What if I, so how do you know where things is? One way to do that is again, like I showed you earlier, you renamed it to something else and then, you know, look at the error message, it will tell you, hey, it doesn't find it, it doesn't know where it is. Okay, and so that's how you figure things out. But again, so this is very safely how, you know, Laravel works. It loads the index page. Every time you load a page, it goes to the public facing, load the index page and it goes from there. Okay, if you don't have this file, if you change it, it's going to crash the site because this is the main site that loads up. That is hookup to Laravel. Okay, and then again, some routes will create routes later and think that's it. Yeah, so I hope this one kind of gives you an idea of where things are, how they connect in Laravel. In the next video, we're going to look at the view and create some view templates.