#Laravel + Vue

6 messages · Page 1 of 1 (latest)

civic vale
#

I am starting to develop an app in Vue (newbie) with a Laravel backend, and I have some doubts:

  • Best practices vue-router / ziggy.js
  • Authentication via Sanctum crsf/session cookie (Fortify), its not clear to me how on the Vue side I can check if the user is authenticated, should I check that the "XSRF-TOKEN" and "laravel_session" cookies aren't expired?
  • How can I manage which routes the user can use in vue router, perhaps by adding the role to the login response?
next rampart
#
  1. cannot reply, too generic
  2. its a cookie, the browser and the backend handle the validation
  3. thats permissions, you can expose the "can" utility to show the current given permissions for the user
long venture
#

Since you say you're new to Vue, I just want to ask if you've considered using Inertia? It won't be a pure Vue SPA, but it'll spare you a lot of the hassle regarding auth and routing.

compact wing
#

Use Inertia JS. All your questions are answered, so you can focus on building your product. No need to worry about these questions

#

If you want to see the implementation of Vue and Laravel with Inertia JS, check Laravel Breeze.

civic vale
#

@long venture @compact wing I have used Inertia fora little, but I still want to understand how to integrate a frontend.