ApiResource provides you already with a CRUD that you need.
If you want to take out a method you could use the ->except() method in the api.php file.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
In API resource route, I want to group like this
Route::apiResources([
'photos' => PhotoController::class,
'posts' => PostController::class,
]);
but I have only methods. How can I put those only methods?
Route::apiResource('news', NewsController::class)->only('index');
Route::apiResource('blogs', PostController::class)->only('index', 'show');
@shaungbhone I don't think it's possible. The apiResource should contain only one api resource controller.
Maybe this will guide you a bit more how it differ from the normal resource controller: https://stackoverflow.com/a/69414549/3145331
Please or to participate in this conversation.