예제 #1
0
 /**
  * returns JSON of requested entry
  *
  * @param $trip_id
  * @param $entry_id
  * @return mixed
  */
 public function getMarker($trip_id, $entry_id)
 {
     $entry = TripEntry::findOrFail($entry_id);
     return $entry;
 }
예제 #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param $trip_id
  * @param $entry_id
  * @param $pic_id
  * @return Response
  * @internal param int $id
  */
 public function destroy($trip_id, $entry_id, $pic_id)
 {
     $pic = Picture::findOrFail($pic_id);
     $trip = Trip::findOrFail($trip_id);
     $entry = TripEntry::findOrFail($entry_id);
     $user = Auth::user();
     if (Auth::user()->id == $trip->user_id && $trip->id == $entry->trip_id && $pic->trip_entry_id == $entry->id) {
         $pic->deleteWithImage($user->id);
         return redirect(url('trip') . '/' . $trip_id . '/entry/' . $entry->id);
     } else {
         return 'You are not authorized to delete this picture!';
     }
 }