[Vuejs]-How to run vue app in the same domain with laravel sanctum for SPA

0👍

If I understand you correctly, you want to use Laravel and Vue.js together in the same application folder?

Should be pretty easy then.

  1. First off, build your application with Vue scaffolding for the frontend.
  2. Then, make a route that redirects everything to a single controller method that returns a spa view. (Or use a closure)
  3. In this view, include your app.js as an asset and include the main Vue component (something like <app></app>).
  4. Then build your Vue app. All requests will now be forwarded to the spa view, which includes your app.js, which should bootstrap Vue.

Leave a comment