laravel resource set status code

39

php artisan make:controller PhotoController --resource --model=Photo
use App\User;
use App\Http\Resources\User as UserResource;

Route::get('/user', function () {
    return (new UserResource(User::find(1)))
               ->response()
               ->setStatusCode(200);
});

Comments

Submit
0 Comments