Laravel Routing & Vue Routing is a free tutorial by Victor Gonzalez from Laravel course
Link to this course(Special Discount):
https://www.udemy.com/course/laravel-...
This is the best Laravel Course
Course summary:
RESTful API Development with Laravel
Vue JS Single Page Application Methodology
Front-End Design Using Tailwind CSS
Implementing Search Functionality Using Laravel Scout
Build a Complete SPA from Scratch
English [Auto]
As I mentioned before we're going to let the view router package actually handle routing for our application. However keep in mind that level is still going to handle the initial authentication so those routes still need to work. So let's jump right into the web that BHP file and let's clean this up a little bit so we can get rid of just about everything here except this authentication rules and then this one singular route. However right now it is a hardcoded slash home. We want it to match everything else. Now in though of course you can use a variable such as any. And then we're gonna hit some sort of controller we'll handle that in just a second and then we don't need a name root. What we really need is to actually match everything and to do that we could use a regular expression so we can say all right the variable any meaning anything that comes after the initial slash it needs to match the following regular expression. And it's gonna be a period meaning any character at all and then an asterix again in regular expression. This just simply means zero or more times. So match anything zero or more times. Basically everything no matter what character it is it is going to be matched and sent over into the home controller. Now the home controller to be honest doesn't make a lot of sense that it's called Home controller. What it really is it is the app controller. So what do we rename the home controller that ships with lava into app controller. So let's find that now. It's inside app HDP controllers. And here it is. So let's go ahead and rename this to app controller instead. And then we'll go ahead and rename the class. So notice it renamed it right here for us. Great. In our constructor we are of course requiring authentication and we will need this. However right now we don't really have a way to register user and sign in and sign out. As a matter of fact we stripped out the entire front end of level so right now it wouldn't even really look right. So we'll go ahead and comment this line out just for the time being. We'll get back to this and we'll turn it back on when we are ready. Now this all it does is it hits an index method and then just returns a view of home. So let's go ahead and visit that home that blade that BHP file and we have all of this code right here. Now to be honest we don't need any of it. We can actually get rid of the entire block. All we really care about is the fact that it is extending a layout and then we have some sort of content area. So in here I'm going to have a new view component which is going to be app appropriately named because of course our entire app will run off of this one view component but so far we haven't even installed all of our dependencies. If you look through here and look inside the node modules there's only a handful of modules in here. We have not installed the entire package that Jason File. So to do that let's go ahead and run npm install. Now this process can take a couple of minutes. So let's jump back and just keep working on our code. OK. So back into our home that blade that BHP file we are requiring this app component but it doesn't exist yet. So let's go ahead and make that happen in the resource directory inside J.S. inside the components directory. Let's go ahead and create a new view component called app and then inside of app for now I will just say hello. Just so that we know we are in fact loading that app that view file. But of course it doesn't work unless we actually registering. However this app that J.S. file. Well it's really setup for the way level does things. We're going to have to do some heavy modifications to it. So let's start off by deleting all of these comments and we actually are not going to load view into the whole entire window so we can get rid of that line. This example component of course is going to go. We're not going to need that and for now we will leave this view app. But of course some modification of this as well is required. So right now view doesn't exist. So let's go ahead an import view from view. OK. So view is available to us because of course the installation finished in the background so we can head back and continue working. So the next thing I know I need is this view router. However if we put all of our roots inside this one app
Watch video Laravel Routing & Vue Routing - Laravel Tutorial online without registration, duration hours minute second in high quality. This video was added by user Nguyen Hoa Hiep 31 October 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site once and liked it people.