Concatenate a view and a json in laravel

0

How to concatenate a view and a json in laravel 5?

$data = Event::get(['id','title','placa','start']);//variables de json

     //Response()->json($data);

    return view('Calendario.calendario');

to be able to return the 2 at the same time

    
asked by Danier Perdomo 06.03.2018 в 16:18
source

1 answer

1

You mean to show it in the view, then it would be like this:

$data = Event::get(['id','title','placa','start']);
return view('Calendario.calendario', compact('data'));

compact creates a matrix that contains variables, in this case your data would be serious (note that the variable name must be the same as in the compact , in this case data )

data you go through in the view later with blade foreach maybe.

    
answered by 06.03.2018 в 16:50