Пример #1
0
 public function index()
 {
     if (Session::has('st_date')) {
         $st_date = Session::get('st_date');
     } else {
         $st_date = date("Y/m/d");
     }
     //Session::flush();
     if (Session::has('ed_date')) {
         $ed_date = Session::get('ed_date');
     } else {
         $ed_date = date("Y/m/d", strtotime($st_date . ' + 2 days'));
     }
     $tour = Tour::take(5)->get();
     $excursion = Excursion::take(5)->get();
     $user_review = HotelReview::take(3)->get();
     $transport_packages = TransportPackage::take(5)->get();
     return View::make('index')->with(array('tour' => $tour, 'excursion' => $excursion, 'user_review' => $user_review, 'st_date' => $st_date, 'ed_date' => $ed_date, 'transport_packages' => $transport_packages));
 }
Пример #2
0
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function excursionDetail($country = '', $excursion_type = '', $excursion = '')
 {
     $x = 0;
     if (!empty($country)) {
         $country = str_replace('-', ' ', $country);
         $get_country_id = DB::table('countries')->where('country', 'LIKE', $country)->where('val', 1)->first();
         $country_id = $get_country_id->id;
     }
     if (!empty($excursion_type)) {
         $excursion_type = str_replace('-', ' ', $excursion_type);
         $get_excursion_type_id = DB::table('excursion_types')->where('excursion_type', 'LIKE', $excursion_type)->first();
         $excursion_type_id = $get_excursion_type_id->id;
     }
     if (!empty($excursion)) {
         $excursion = str_replace('-', ' ', $excursion);
         $get_excursion_id = DB::table('excursions')->where('excursion', 'LIKE', $excursion)->where('val', 1)->first();
         $excursion_id = $get_excursion_id->id;
     }
     $transport_type = ExcursionTransportType::where('excursion_type_id', '=', $excursion_type_id)->lists('transport_type', 'id');
     $path = array();
     $directory = public_path() . '/images/excursion_images/excursion_types/';
     $images = glob($directory . $excursion_id . "_" . "*.*");
     foreach ($images as $image) {
         $path[] = $image;
     }
     $excursion = Excursion::where('id', $excursion_id)->where('val', 1)->first();
     $excursion_type = ExcursionType::where('id', $excursion_type_id)->first();
     $excursion_rate = ExcursionRate::where('excursion_id', $excursion_id)->where('val', 1)->get();
     //        dd(DB::getQueryLog());
     if (!$excursion->count()) {
         return Redirect::to('/403');
     }
     return View::make('excursion.excursion_details')->with(array('x' => $x, 'excursion' => $excursion, 'excursion_id' => $excursion_id, 'excursion_type_id' => $excursion_type_id, 'path' => $path, 'excursion_type' => $excursion_type, 'transport_type' => $transport_type, 'excursion_rate' => $excursion_rate));
 }