/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { Gallery::destroy($id); $showDefault = cmsHelp('App\\Gallery', 'galleries'); return Redirect('galleryAdmin')->with($showDefault); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $gallery = Gallery::find($id); if (File::exists(public_path() . '/admin/images/gallery/' . $gallery->image)) { File::delete(public_path() . '/admin/images/gallery/' . $gallery->image); } if (count($gallery->GalleryImages) > 0) { foreach ($gallery->GalleryImages as $img) { if (File::exists(public_path() . '/admin/images/gallery/' . $img->name)) { File::delete(public_path() . '/admin/images/gallery/' . $img->name); } } } Gallery::destroy($id); return response()->json(['message' => 'Gallery successfully deleted']); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $gallery = Gallery::findOrFail($id); unlink(base_path() . '/public/images/galleries/' . $gallery->picture); // delete folder & pictures Gallery::destroy($id); return redirect(route('admin.galleries.index'))->with('success', 'La galerie photo a bien été supprimée'); }