resource in laravel 7 code example
Example 1: laravel create resource controller
php artisan make:controller PhotoController --resource
Example 2: laravel resource set status code
use App\User;
use App\Http\Resources\User as UserResource;
Route::get('/user', function () {
return (new UserResource(User::find(1)))
->response()
->setStatusCode(200);
});