Return view and data with laravel and vuejs

0

I'm developing an application in laravel and the calls to get data with vues but I have a problem. This is my controller return for the view:

public function dashboard() {

        if(session('usuario_id') !== null) {

            $usuario = Usuarios::where('usuario_id', session('usuario_id'))->get();
            $empresa = Empresa::where('usuario_id', session('usuario_id'))->get();

            return view('app/dashboard/dashboard')->with('usuario', $usuario);
        } else {
            return redirect('/login');
        }
    }

I want that when loading the page, user data is passed to the popular vuejs respective fields yet, what is returned for vuejs is the html page that the laravel view returns. How to make this separation? Render the page normally with the blade but get the data through the vues? I'm doing this in the same view returns, I would not like to have to just create a route for the vuejs to get the data from another function in the controller. It would be a lot of rework to have to do extra functions on every page that I wanted to return with the unpopular data through the blade.

    
asked by anonymous 14.01.2018 / 02:38

0 answers