Usually, Eloquent API Resources return content on the "data" section.
We can remove the data
section just with add JsonResource::withoutWrapping();
in app/Providers/AppServiceProvider.php
.
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
JsonResource::withoutWrapping();
}
}
If you know a better way, please teach me in the comments :)
Top comments (0)