Laravel - Controllers - Api Resource Routes

When declaring resource routes that will be consumed by APIs, you will commonly want to exclude routes that present HTML templates such as create and edit. For convenience, you may use the apiResource method to automatically exclude these two routes:

    use App\Http\Controllers\PhotoController;
    Route::apiResource('photos', PhotoController::class);

You may register many API resource controllers at once by passing an array to the apiResources method:

    use App\Http\Controllers\PhotoController;
    use App\Http\Controllers\PostController;
        'photos' => PhotoController::class,
        'posts' => PostController::class,

To quickly generate an API resource controller that does not include the create or edit methods, use the --api switch when executing the make:controller command:

    php artisan make:controller PhotoController --api