mardi 20 novembre 2018

Getting Logged in User in Laravel SPA

I have a small Laravel SPA built using Passport for auth and Vue. I want to grab the logged in user when/if a user refreshes the page.

I thought to try using a view composer and dump it into the JavaScript using the laracasts/utilities package, but it doesn't pick up the logged in user at that point.

I tried adding a base controller class that the had an auth check in the constructor, but again it doesn't seem to pick up the user; the auth only gets the user when in a function.

I could make a call from vue component on page load.

What is the preferred method of getting the logged in user?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire