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
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
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.