Skip to content
Advertisement

Return multiple array to Response::json laravel?

How we can return multiple array in json. Suppose we get the following response in Laravel eloquent:

JavaScript

Now I want to return response in json which include these data:

JavaScript

Using the above method empty value is returned. Any help would be appreciated

Sorry guys. I found the solution. The data that I was passing was already in object form. Therefore I needed to convert it into an array and then pass it.

JavaScript

Now it will work!

Advertisement

Answer

i think you can try this method:

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