/**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $input = Input::all();
     $destination = TourDestination::where('name', '=', $input['slDestination'])->first();
     $jquery = DB::table('tours');
     if ($input['slDestination'] != 1) {
         $jquery->whereRaw('(depart_from = ? OR going_to = ?)', [$destination->id, $destination->id]);
     }
     if ($input['slDuration'] != -1) {
         $duration = explode('-', $input['slDuration']);
         if ($duration['1'] == ">") {
             $jquery->whereRaw('duration > ?', [$duration[0]]);
         } else {
             $jquery->whereBetween('duration', $duration);
         }
     }
     if ($input['slPrice'] != -1) {
         $price = explode('-', $input['slPrice']);
         if ($price['1'] == ">") {
             $jquery->whereRaw('price > ?', [$price[0]]);
         } else {
             $jquery->whereBetween('price', $price);
         }
     }
     $data = $jquery->where('active', 1)->get();
     return view('search.findyourstrip', compact('data'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $data = [];
     $data['tours'] = Tour::select('alias', 'name', 'duration')->latest('created_at')->where('day_tour', 0)->published()->take(6)->get();
     $data['day_tours'] = Tour::select('alias', 'name')->latest('created_at')->where('day_tour', 1)->published()->take(12)->get();
     $data['destinations'] = TourDestination::where('active', 1)->orderBy('name', 'ASC')->get();
     $data['reviews'] = TourReview::latest('created_at')->where('active', 1)->take(4)->get();
     $data['title'] = "Vietnam Tours - Planning tours to Vietnam with the best offers";
     $data['description'] = "Book travel for less with specials on cheap airline tickets, hotels, car rentals, and flights on TraveloVietnam.com, your one-stop resource for travel and vacation needs";
     $data['keywords'] = "vietnam travel, travel to vietnam, vietnam tours, tours in vietnam, vietnam hotels, hotels in vietnam, vietnam visa, visa to vietnam";
     return view('welcome', $data);
 }
 /**
  * Show the tours page filter by destination.
  *
  * @return \Illuminate\Http\Response
  */
 public function destination($destination)
 {
     $region = ['northern', 'southern', 'central'];
     if (in_array($destination, $region)) {
         $destinations = TourDestination::where('region', '=', ucfirst($destination) . ' Vietnam')->get();
         $des_array = [];
         foreach ($destinations as $des) {
             array_push($des_array, $des->id);
         }
         $tours = Tour::whereIn('going_to', $des_array)->orWhereIn('depart_from', $des_array)->published()->get();
         return view('vietnam.destination', ['tours' => $tours, 'destination' => ucfirst($destination) . ' Vietnam']);
     } else {
         $destination = TourDestination::where('alias', '=', $destination)->first();
         if ($destination) {
             $tours = Tour::where('going_to', $destination->id)->orWhere('depart_from', $destination->id)->published()->get();
             return view('vietnam.destination', ['tours' => $tours, 'destination' => $destination->name]);
         }
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $destinations = TourDestination::where('active', 1)->get();
     return view('tour_request.index')->withDestinations($destinations);
 }