Exemple #1
0
 /**
  * Display a listing of hotels
  *
  * @return Response
  */
 public function getIndex()
 {
     if (Input::has('pais')) {
         $string = Input::get('pais');
         $pais = Pais::Where('name', 'LIKE', "%{$string}%")->first();
         if ($pais) {
             $hoteis = Hotel::Where('pais_id', '=', $pais->id)->with('caracteristicas')->paginate(5);
             if (count($hoteis) > 0) {
                 $hotels = $hoteis;
                 $count = $hoteis->count();
             }
         } else {
             $hotels = array();
             $count = 0;
         }
     } else {
         $hotels = Hotel::with('pais', 'caracteristicas')->Where('publicado', '=', 1)->paginate(5);
         $count = Hotel::with('pais')->Where('publicado', '=', 1)->count();
     }
     $paises = Pais::has('hoteis')->get();
     foreach ($paises as $pais) {
         $json[] = $pais->name;
     }
     $json = json_encode($json);
     return View::make('hotels.index', compact('hotels', 'count', 'json'));
 }
 /**
  * Display a listing of translados
  *
  * @return Response
  */
 public function getIndex()
 {
     if (Input::has('pais')) {
         $string = Input::get('pais');
         $pais = Pais::Where('name', 'LIKE', "%{$string}%")->first();
         $translados = Translado::with('pais')->Where('pais_id', '=', $pais->id)->Where('publicado', '=', 1)->paginate(5);
         $count = Translado::with('pais')->Where('pais_id', '=', $pais->id)->Where('publicado', '=', 1)->count();
     } else {
         $translados = Translado::with('pais')->Where('publicado', '=', 1)->paginate(5);
         $count = Translado::with('pais')->Where('publicado', '=', 1)->count();
     }
     $translados = $this->removeHtmlDescricao($translados);
     $paises = Pais::all();
     foreach ($paises as $pais) {
         $json[] = $pais->name;
     }
     $json = json_encode($json);
     return View::make('translado.index', compact('translados', 'count', 'json'));
 }
 /**
  * Display a listing of eventos
  *
  * @return Response
  */
 public function getIndex()
 {
     $eventos = EventoEspecial::with('pais')->Where('publicado', '=', 1);
     if (Input::has('pais')) {
         $string = Input::get('pais');
         $pais = Pais::Where('name', 'LIKE', "%{$string}%")->first();
         $eventos = $eventos->Where('pais_id', '=', $pais->id);
     }
     if (Input::has('tipo')) {
         $eventos = $eventos->Where('tipo', '=', Input::get('tipo'));
     }
     $count = $eventos->count();
     $eventos = $eventos->paginate(5);
     $eventos = $this->removeHtmlDescricao($eventos);
     $pais = Pais::all();
     foreach ($pais as $pais) {
         $json[] = $pais->name;
     }
     $json = json_encode($json);
     return View::make('eventoespecial.index', compact('eventos', 'count', 'json'));
 }