Home route
Let's now add a server-side route for the home page so that we can load our app from the root path. This new route will point to a get_home_web
 method in our ListingController
 class.
routes/web.php
:
<?php Route::get('/', 'ListingController@get_home_web'); Route::get('/listing/{listing}', 'ListingController@get_listing_web');
Going to the controller now, we'll make it so the get_home_web
 method returns the app
 view, just as it does for the listing web route. The app
 view includes a template variable model which we use to pass through the initial application state, as set up in Chapter 5, Integrating Laravel and Vue.js with Webpack. For now, just assign an empty array as a placeholder.
app/Http/Controllers/ListingController.php
:
public function get_home_web() { return view('app', ['model' => []]); }
With that done, we can now navigate to http://vuebnb.test/
 and it will work! When the Vue app is bootstrapped, Vue Router will check the URL value and, seeing that the path is ...