Imagine entities Genre
and Book
.
Each have API resource endpoints /genre
and /book
. In Laravel routes that might be:
$app->resource('/genre', GenreController::class);
I want an endpoint for the relationship. GET /genre/1/book
, to get books under the Genre
#1.
What is best practice here? Place the handlers in GenreController
, BookController
or maybe a whole new controller?
On a sidenote, I am using the dingo-api
package, but I don't suppose that makes any difference.
via Zoon