php - Trying to receive object in route - Laravel
I've been struggling with a problem the last couple of days. I build my application with a backend of Laravel and the frontend of Vue. Now I want to get data from the backend through Vue, this is done by an Axios call. When I call the route I just want to call an object (which is set, already tested), but when it is returned it I empty? We triedjson_encode
,response()->json()
, but without luck.
Our route:
Route::get('/pageSpeed', function(Request $request){
$ps = new PageSpeedAPIController($request->url);
$ps = $ps->getData();
return response()->json($ps);
});
This is callinggetData
in our controller. Below you see thegetData
function.
public function getData() {
return $this->getPageStats();
}
Hope you guys understand the problem and maybe have a solution for it :)