Skip to content
Advertisement

Cannot use object of type Illuminate\Http\JsonResponse as array in Laravel

i have data of set like this:

JavaScript

I need to fetch the event only and remove the empty events. However first i tried to fetch the events liket this, But it give an error.

JavaScript

But it give me an error : Cannot use object of type IlluminateHttpJsonResponse as array

Can anyone please help me to resovle the issue?

Thank you

Advertisement

Answer

You need to decode $data[0] not $data since you’re doing

JavaScript

same for loop ,you should do

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement