/** * Remove the specified album from the database. * * @param int $id Id of the album * @return \Illuminate\View\View */ public function destroy($id) { $album = new Entity\Album(); $album->map(['id' => $id]); \Gallery::album()->delete($album); return \Redirect::route("gallery")->with('alertsuccess', \Lang::get('gallery::gallery.removal')); }
public function createAlbum($data = null, $add = true) { $faker = \Faker\Factory::create(); $album = new Entity\Album(); $metadata = ['id' => $faker->unique()->randomDigitNotNull(), 'name' => $faker->name, 'description' => $faker->sentence(3)]; if (!is_null($data)) { foreach ($data as $key => $value) { $metadata[$key] = $value; } } $album->map($metadata); if ($add) { $this->albums->add($album); } return $album; }
public function delete(Entity\Album $album) { return Album::withTrashed()->where('id', $album->getId())->forceDelete(); }