public function restoreFromAlbum($albumId) { $albumPhotos = Photo::withTrashed()->where('album_id', $albumId)->get(); foreach ($albumPhotos as $photo) { $this->restore($photo->photo_id); } }
/** * Display the specified albums' photos. * * @param int $id Id of the album * @return \Illuminate\View\View */ public function show($id) { $album = $this->album->findOrFail($id); $albumPhotos = $this->photo->findByAlbumId($id); $this->layout->content = \View::make('gallery::album', array('album' => $album, 'albumPhotos' => $albumPhotos)); }
/** * Remove the specified photo from the database. * * @param int $albumId Id of the album * @param int $photoId Id of the photo * @return \Illuminate\View\View */ public function destroy($albumId, $photoId) { $this->photo->delete($photoId); return \Redirect::route("gallery.album.show", array('id' => $albumId)); }
public function delete(Entity\Photo $photo) { return Photo::withTrashed()->where('id', $photo->getId())->forceDelete(); }