Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function getDelete($id) {
- //Let's first find the image
- $image = Photo::find($id);
- //If there's an image, we will continue to the deletingprocess
- if($image) {
- //First, let's delete the images from FTP
- File::delete(Config::get('image.upload_folder').'/'$image->image);
- File::delete(Config::get('image.thumb_folder').'/'$image->image);
- //Now let's delete the value from database
- $image->delete();
- //Let's return to the main page with a success message
- return Redirect::to('/')->with('success','Image deleted successfully');
- } else {
- //Image not found, so we will redirect to the indexpage with an error message flash data.
- return Redirect::to('/')->with('error','No image with given ID found');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement