/**
  * Remove the specified resource from storage.
  * @access  public
  * @param  $id        int
  * @return Redirect
  */
 public function destroy($id)
 {
     try {
         $sighting = Sighting::find($id);
         $trip_id = $sighting->trip_id;
         $sighting->delete();
         $flashMessage = 'Removed sighting.';
     } catch (Exception $e) {
         $flashMessage = $e->getMessage();
     }
     return Redirect::to('/admin/trips/' . $trip_id . '/sightings')->with('flashMessage', $flashMessage);
 }
Пример #2
0
 public function addSighting()
 {
     if (!Input::has('id') || !Input::has('lat') || !Input::has('lon') || !Input::has('username')) {
         return "failure";
     }
     try {
         $sighting = new Sighting();
         $sighting->TaxonID = Input::get('id');
         $sighting->Latitude = Input::get('lat');
         $sighting->Longitude = Input::get('lon');
         $sighting->Date = new DateTime();
         $sighting->Username = Input::get('username');
         $sighting->save();
         return "success";
     } catch (Exception $e) {
         return "failure";
     }
 }