Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Full-Stack Vue.js 2 and Laravel 5

You're reading from   Full-Stack Vue.js 2 and Laravel 5 Bring the frontend and backend together with Vue, Vuex, and Laravel

Arrow left icon
Product type Paperback
Published in Dec 2017
Publisher Packt
ISBN-13 9781788299589
Length 376 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Anthony Gore Anthony Gore
Author Profile Icon Anthony Gore
Anthony Gore
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
1. Hello Vue – An Introduction to Vue.js FREE CHAPTER 2. Prototyping Vuebnb, Your First Vue.js Project 3. Setting Up a Laravel Development Environment 4. Building a Web Service with Laravel 5. Integrating Laravel and Vue.js with Webpack 6. Composing Widgets with Vue.js Components 7. Building a Multi-Page App with Vue Router 8. Managing Your Application State with Vuex 9. Adding a User Login and API Authentication with Passport 10. Deploying a Full-Stack App to the Cloud Index

Mock data


We've now completely migrated the Vuebnb prototype into our Laravel project, plus we've added a build step. Everything in the frontend app is working as it was in Chapter 2Prototyping Vuebnb, Your First Vue.js Project.

However, we still have mock data hard-coded into the frontend app. In this last part of the chapter, we're going to remove that hard-coded data and replace it with data from the backend.

Routes

Currently, the home route, that is, /, loads our frontend app. But what we've built for our frontend app so far is not meant to be a home page! We'll be building that in future chapters.

What we've built is the listing page, which should be at a route like /listing/5, where 5 is the ID of the mock data listing being used.

Page

Route

Home page

/

Listing page

/listing/{listing}

Let's modify the route to reflect this.

routes/web.php:

<?php

use App\Listing;

Route::get('/listing/{listing}', function ($id) {
  return view('app');
});

Just like in our api/listing/{listing} route, the dynamic...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images