Esempio n. 1
0
 /**
  * Remove the specified officer from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $officer = Officer::findOrFail($id);
     $destinationPath = public_path() . DIRECTORY_SEPARATOR . 'uploads/fotopetugas' . DIRECTORY_SEPARATOR . $officer->foto;
     try {
         File::delete($destinationPath);
     } catch (FileNotFound $e) {
         // File sudah dihapus/tidak ada
     }
     Officer::destroy($id);
     return Redirect::route('user.officers.index')->with("successMessage", "Data petugas berhasil dihapus");
 }