Пример #1
0
 /**
  * Remove the specified sponsor from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $sponsor = Sponsor::findOrFail($id);
     $destinationPath = public_path() . DIRECTORY_SEPARATOR . 'uploads/sponsor' . DIRECTORY_SEPARATOR . $sponsor->logo;
     try {
         File::delete($destinationPath);
     } catch (FileNotFound $e) {
         // File sudah dihapus/tidak ada
     }
     Sponsor::destroy($id);
     return Redirect::route('admin.sponsors.index')->with("successMessage", "Sponsor berhasil dihapus")->withTitle("Sponsor");
 }