Ive 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 a 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 tried json_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 calling getData in our controller. Below you see the getData function.
public function getData() {
return $this->getPageStats();
}
Hope you guys understand the problem and maybe have a solution for it :)
via Kevin Steen Hansen