Starting the Dev Server 0:00I know you're eager to look at something in the browser. That's the exciting part. So let's do that now. I'm going to switch back to my terminal, and if I run this command, php artisan, you'll see it brings up dozens of various commands that you can run for your Laravel project. Again, don't let this overwhelm you. You will eventually learn most of these, but when you're getting started, you can get away with just a small handful. Do not be overwhelmed. Now, if I scroll to the top, you'll see that there is a command here named serve.Do not be overwhelmed. Now, if I scroll to the top, you'll see that there is a command here named serve. Serve the application on the basic PHP development server. All right, this is the easiest way to get up and running. php artisan serve. All right, we have a development server at localhost port 8000. And there we go. This is what you get when you install Laravel for the first time. But how does that work? Let me show you. Understanding Route to View 0:51But how does that work? Let me show you. I'm going to go into this routes file. Now most of your time in the early days will be spent within the web routes file. Let's take a look at this. Now I bet without knowing anything about Laravel, you can basically understand it. Let's read it together. All right, we have a route, and when we get forward slash, okay, probably the home page. When we get the home page route, I want to return a view called welcome. Hmm, all right. Exploring the Views Folder 1:15When we get the home page route, I want to return a view called welcome. Hmm, all right. Let me bring back my sidebar. Views in Laravel are stored in your resources directory. Resources is where you will access your views and your assets, whether it's SAS you're writing or CSS or stylus or any of those you can use, or your JavaScript, your React code, your view code. Any of that will be located here in a Laravel project. Let me open the views directory, and I have one file, welcome. All right, well, I bet this is the file that's being loaded when I visit this page.Let me open the views directory, and I have one file, welcome. All right, well, I bet this is the file that's being loaded when I visit this page. Let's look for Laravel. There it is. So let's update it to LaraCass and see if it's reflected. Refresh, and there we go. We have full control over this page. So that means I could delete everything, start again, and we'll say, here we go, Mario voice. So give it a refresh, and you're ready to begin. Let's finish up by loading your second route. Using Editor Quick Open 2:13So give it a refresh, and you're ready to begin. Let's finish up by loading your second route. Now, I'm going to open up the sidebar one more time, open up routes, web, but using your editor, it's really important that you find shortcuts here. That way you're not constantly going to a directory, toggling it, finding the file, clicking on it. Instead, most editors these days will have some kind of quick find. In Sublime, it's Command P. I can just type routes slash web, or you can even use shorthand, like R for routes and W for web, and you can see I can pull it up. So if you ever see me do that, that's what's happening.like R for routes and W for web, and you can see I can pull it up. So if you ever see me do that, that's what's happening. Routes, web, and now I'm in that file. Or if I need to go back to that welcome view, in real life, I would never go to resources, views, welcome. Instead, I would simply type welcome, and you can see which file I want to access. Okay. So again, not knowing anything, we can kind of piece together. If the user makes a route get request, and if you're not familiar with get requests, you will soon. Creating a Contact Route 3:09If the user makes a route get request, and if you're not familiar with get requests, you will soon. But for now, just imagine it to be a standard fetch and load this page request. In response, we load this view called welcome. We're going to do another one here. We're going to load a contact page, and there I'm going to load a view called contact. Okay. So read it out again. Register a new route get request for slash contact. That stands for example.com slash contact.Register a new route get request for slash contact. That stands for example.com slash contact. And in response, we're going to load a view called contact. Now if I were to run this, though, let's go to contact. Uh-oh. Laravel is going to let you know there is no view called contact. So what do you want me to do here? And it blows up. Let's fix the problem. I'm going to go to my resources directory, views, and I'm going to add a new file here Adding the Contact View 3:52Let's fix the problem. I'm going to go to my resources directory, views, and I'm going to add a new file here called contact.blade.php. Well now at the moment, I'm just going to copy all of this over, but you'll learn pretty quickly that this breaks down. We don't want to copy all of this stuff to every single view we create. Think about it. What if you added a style sheet? Like so. Well, you'd have to go to every single file and do the same thing.Like so. Well, you'd have to go to every single file and do the same thing. It breaks down very quickly, but we'll talk about that later. Let's curb that one for now. Anyways, here we can register our contact form. We're not actually going to build one. I'll show you how to do that later. But nonetheless, if I refresh the page, you now have a route for the home page, and you have a route for the contact page. Let's finish up by adding a link to this contact page from our home page.have a route for the contact page. Let's finish up by adding a link to this contact page from our home page. Say right here. Nothing fancy here, but that's okay. We're only interested in learning. Contact us to learn more. Alright, let's make this an anchor tag that goes to slash contact. Begin at the root, then go to slash contact. Now refresh, contact, and we're now on that new page. And again, we knew this was going to work because we registered a route for it.Now refresh, contact, and we're now on that new page. And again, we knew this was going to work because we registered a route for it. So if I didn't have this, and we tried it again, refresh, contact, you're going to get a pretty, a beautiful 404 page. That's Laravel's way of saying, well, you requested something, and I don't know what to do. I don't have anything registered for contact. So whoops, 404. Let's come back, return it. When the user makes a GET request to slash contact, load this view.Let's come back, return it. When the user makes a GET request to slash contact, load this view. Next, we have a link that points to that endpoint. So everything should work. Refresh, contact, and I hope that makes sense. In the next episode, we'll move on.