/** * delete content from the database * @param $id * @param $path * @return bool * @throws \Exception */ public static function deleteContent($id, $path) { $status = false; try { $galleryContent = GalleryContent::find($id); $path .= $galleryContent->contentName . '.' . $galleryContent->contentFileExtension; File::Delete($path); $galleryContent->delete(); $status = true; } catch (Exception $e) { } return $status; }
/** * delete existing video to the database * @param int $id * @return Response */ public function deleteVideoFromGallery($id) { if (GalleryContent::deleteContent($id, 'client/video/vid-gallery/')) { Notify::success('Video deleted successfully'); return redirect()->action('AdminDashboardController@showVideoGallery'); } else { Notify::warning('Video was not deleted'); return redirect()->action('AdminDashboardController@showVideoGallery'); } }
/** * show gallery navigation controller. * * * @return Response */ public function showGallery() { $galleryContentImages = GalleryContent::where('contentType', '=', 'image')->get(); $galleryContentVideos = GalleryContent::where('contentType', '=', 'video')->get(); return view('pages.client.clientGallery', array('imageList' => $galleryContentImages, 'videoList' => $galleryContentVideos)); }