1php artisan make:controller PhotoController --resource --model=Photo
2Route::resource('photos', PhotoController::class);
1//creating a resource collection
2php artisan make:resource ResourceCollectionName --collection
3//creating a resource
4php artisan make:resource ResourceName
1use App\User;
2use App\Http\Resources\User as UserResource;
3
4Route::get('/user', function () {
5 return (new UserResource(User::find(1)))
6 ->response()
7 ->setStatusCode(200);
8});