php - Trying to receive object in route - Laravel

15

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 :)

People are also looking for solutions to the problem: javascript - How to reorder the table serial no after deleting the row

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.