Resource 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.

Route::apiResource('photos', 'PhotoController');
Route::apiResources([ 'photos' => 'PhotoController', 'posts' => 'PostController' ]);
Php artisan make:controller API/PhotoController --api

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

O 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.

Resource Controllers: API Resource Routes — Structure map

Clickable & Draggable!

Resource Controllers: API Resource Routes — Related pages: