Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Browse all series

Laravel, Vue and SPAs

In this series, come along as I build an "assets" website for Laracasts. Using Laravel as a backend, step-by-step, we'll pull in Vue and Vue Router to construct a practical and real-life single-page application.

Progress

Series Info

Episodes
10
Run Time
1h 24m
Difficulty
Intermediate
Last Updated
May 23, 2019
Version
Latest

Series Episodes

  1. Episodes (10)
    1. One Component Per Page

      We'll take a one-component-per-page approach to this website. This means, for each link in the sidebar, we need to create a companion Vue component. When finished, we'll review how to apply "active link" styling to the currently selected page.
    2. General Page Styling

      With the basic structure in place, we can now move on to general page styling and tweaks.
    3. Lazy Loading Routes

      To help improve performance, any route can be lazily-loaded by embracing Vue's async components and webpack's code-splitting feature. Don't worry: I hate confusing jargon, too. Let's break it down and review exactly when and why you might consider lazy loading certain routes in your app.
    4. Cross-Origin Resource Sharing (CORS)

      Due to security concerns, it's not always so easy to make a cross-origin AJAX request to fetch a particular set of data. Instead, you'll often be met with the dreaded No 'Access-Control-Allow-Origin' header is present on the requested resource response. Let's discuss what this header means, and how we can fix it.
    5. Token-Based API Authentication

      Now that you've learned how to make cross-origin AJAX requests, let's move on to the next step: API authentication. In this episode, we'll use a token-based approach as our "permission slip" for fetching user-specific data from the server.
    6. Hashed API Tokens

      Let's next discuss how to generate hashed API tokens that Laravel can validate against. As of Laravel 5.8, we only need to visit the config/auth.php> file to enable hash-checking.
    7. Generating New Tokens

      Any third party platform will need to offer users some way to revoke and generate new API tokens. Let's review a basic example of how you might do that.

Continue Learning