Passing the logged in User data to Vue component Hello,
I have a Vue component that's made of various "sub" Components.
I need to pass the logged in User data to one of these sub Component. Of course the user can be logged in or not.
How would you achieve that?
I tried to use a prop on my main Component, but it didn't seem to work. Here's what I did:
<main-component :user="{{ Auth::check() ? Auth::user() : '' }}"></main-component>
Thanks in advance!
<main-component
@if (auth()->check())
:user="{{ auth()->user() }}"
@endif
>
</main-component>
Awesome, thank you Edoc!
Is there any way to pass this to the root Vue instance and then to the components that would need the user? Make it a little more reusable?
Thanks!
@alexcanana
Is there any way to pass this to the root Vue instance
I'm also battling with this. I don't think there is a "standard" way to pass this, but perhaps the Laravel community has a "best practices" way?
Then also, with regards to the passing of the data, how do you "receive" it again on the VueJS component side?
Also what is the command to pay just a few properties, and not the whole shebang for example the password?
Please sign in or create an account to participate in this conversation.