@brunitosessa do you looked at resource collections?
Route::get('/test', function () {
return TestResource::collection(Test::all());
});
https://laravel.com/docs/7.x/eloquent-resources#resource-collections
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, I'm trying to create an api resource to return data to an ionic project. I need to include in one response information about two models. Following best practices, which would be the best approach to do this?
@brunitosessa so it seems like promotions are Bar's relationship?
https://laravel.com/docs/7.x/eloquent-resources#conditional-relationships
Please or to participate in this conversation.