Example #1
0
 /**
  * [getDetailAndInfoAround description]
  * @param  [type] $id [description]
  * @return [type]     [description]
  */
 public static function getDetailAndInfoAround($id)
 {
     $tour = Tour::find($id);
     $tour->departure = Departure::find($tour->departure_id);
     $tour_relevant = DB::table('tours')->where('departure_id', $tour->departure_id)->take(4)->get();
     foreach ($tour_relevant as $key => $value) {
         $image = TourImage::where('tour_id', $value->id)->first();
         $tour_relevant[$key]->image = $image;
         $tour_relevant[$key]->periodNature = HomeController::periodNature($value->period);
     }
     $tour->tour_relevant = $tour_relevant;
     $tour->destinations = DB::table('destinations')->join('tour_destinations', 'destinations.id', '=', 'tour_destinations.destination_id')->where('tour_destinations.tour_id', $id)->get();
     return $tour;
 }