Je sais plus

This commit is contained in:
Cassandre Cantet 2017-10-21 09:03:04 +02:00
parent 7416cf37ec
commit b15ab7fd07
2 changed files with 11 additions and 0 deletions

View File

@ -44,6 +44,13 @@ class ImagesController extends BaseController
return response()->json($image); return response()->json($image);
} }
public function delete($id) {
$image = Image::findOrFail($id);
$image->delete();
return response()->json("Delete ".$id." succesfully");
}
private function getOriginal($filename) private function getOriginal($filename)
{ {
$path = $this->getImagePathOrAbort($filename); $path = $this->getImagePathOrAbort($filename);

View File

@ -52,6 +52,10 @@ class ImagesServiceProvider extends ServiceProvider
$router->get('images/{filename}', [ $router->get('images/{filename}', [
'as' => 'getPicture', 'uses' => 'ImagesController@get' 'as' => 'getPicture', 'uses' => 'ImagesController@get'
]); ]);
$router->delete('images/{id}', [
'as' => 'deletePicture', 'uses' => 'ImagesController@delete'
]);
}); });
} }