Support the ongoing development of Laravel.io →
Security
Last updated 10 months ago.
0
Solution

maybe put it within another array?

echo Response::json(array('data' => array(array('name' => 'Test'))));
Last updated 10 months ago.
0

Thanks! That works great.

Last updated 10 months ago.
0

Use this package awesome....

"league/fractal": "0.8.*"
Last updated 10 months ago.
0

You could always do something like this, in filters.php:

App::after(function($request, $response)
{
    if ($response instanceof Symfony\Component\HttpFoundation\JsonResponse)
        $response->setData(['result' => $response->getData()]);
});

Note that I used result here rather than data, if you prefer data then just change it

Last updated 10 months ago.
0

Sign in to participate in this thread!

LaraJobs

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 Laravel.io - All rights reserved.