mercredi 22 février 2017

Is it possible to get Laravel user data from Vue JS?

i have a Laravel 5.4 application where i do all Authentication based logic through PHP and then redirect the user to a catchAll route when they are authenticated, and let VueRouter take it from there...

I'd like to also use Entrust because my app will have several types of users and some elements (like an Edit User button) will only be visible to some user Roles. I might also want to implement specific permissions, like some Admins can edit user Permissions, while others do not.

The issue is, alright i'm in Javascript territory now, so how do i know what my current Auth user is? Setting a global JS variable for Auth::user doesn't seem like a good idea to me.

Perhaps i would instead pass just an ID, but how exactly without making it globally visible as a window variable?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lKRdoM
via IFTTT

Aucun commentaire:

Enregistrer un commentaire