Exemplo n.º 1
0
 public function getContinentes()
 {
     $continentes = Continente::has('pacotes');
     if (Input::has('continente')) {
         $continentes->where('name_en', 'LIKE', '%' . Input::get('continente') . '%')->orWhere('name_pt', 'LIKE', '%' . Input::get('continente') . '%')->has('pacotes');
     }
     $continentes = $continentes->get();
     $count = $continentes->count();
     $json = [];
     foreach ($continentes as $cont) {
         $json[] = $cont->name_pt;
     }
     $json = json_encode($json);
     return View::make('pacote.lista_continente', compact('continentes', 'count', 'json'));
 }