25.06.2018 Views

Full-Stack Vue.js 2 and Laravel 5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Controller<br />

We'll be adding more routes to retrieve the listing data as the project progresses.<br />

It's a best practice to use a controller class for this functionality to keep a<br />

separation of concerns. Let's create one with Artisan CLI: $ php artisan<br />

make:controller ListingController<br />

We'll then move the functionality from the route into a new method,<br />

get_listing_api.<br />

app/Http/Controllers/ListingController.php:<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!