Exemplo n.º 1
0
 public function destroy($id)
 {
     $album = Album::findOrFail($id);
     if (Gate::denies('album_authorize', $album)) {
         return "authorize fails";
     }
     foreach ($album->img as $albums) {
         File::delete(['uploads/' . $albums->name, 'uploads/thumbnails/' . 'thumbnail_' . $albums->name, 'uploads/' . $albums->thumbnail, 'uploads/thumbnails/' . $albums->thumbnail, 'uploads/' . $albums->thumbnail2, 'uploads/thumbnails/' . $albums->thumbnail2]);
     }
     Img::where('album_id', $album->id)->delete();
     Album::destroy($id);
     return redirect('/admin/albums/');
 }