Saturday, March 18, 2017

Laravel, cannot delete item from model

I have the following in ImageController.php:

public function destroy($id)
{
    $image = Image::find($id);
    $image->delete();
    return Response;
}

And in route/web.php:

Route::resource('image', 'ImageController');

But when using Postman for Chrome to send a DELETE request to http://localhost:8000/image/5 (currently returns an image when using GET), the image isn't removed from the server.

What am I doing wrong?



via Sandi

Advertisement