Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Flex's avatar
Level 4

Laravel blade file data do not pass Vue 3

working with Laravel 10 and vue js 3 with vuex 4 in state management. I have following welcome.blade.php

<script>
        (function () {
            window.Laravel = {
                csrfToken: '{{ csrf_token() }}',
                user: @json(Auth::user())
            };
            console.log('Laravel User:', window.Laravel.user);
        })();
    </script>
</head>
<body>


<div id="app">
             @if(Auth::check())
                <mainapp :user="{{Auth::user()}}"></mainapp>
            @else 
                <mainapp :user="false"></mainapp>
            @endif
         
</div>


    <script src="{{ mix('js/app.js') }}"></script>
</body>

and mainapp.vue file

and store.js

my logged user data print on Laravel blade file but not passed it to vue file and as the result of that not showing menus as well. what is the problem with not passing data with vue file

0 likes
0 replies

Please or to participate in this conversation.