public function query()
 {
     $query = Input::get('estabelecimento');
     $res = \App\Municipio::select('co_municipio', 'nome', 'uf')->where('nome', 'LIKE', "%{$query}%")->limit(10)->get();
     //$res   = \App\Estabelecimento::where('nome', 'LIKE', "%$query%")->get();
     return Response::json($res);
 }
 /**
  * Display the co_municipio
  *
  * @param  string  $city
  * @param  string  $state
  * @return Response
  */
 public function query()
 {
     $city = Input::get('city');
     $state = Input::get('state');
     //ordenando o co_municipio por ordem decrescente, evitamos retornar estados com o mesmo nome da cidade, como é o caso do Rio de Janeiro
     $id = \App\Municipio::select("co_municipio")->where('nome', $city)->where('uf', $state)->orderBy('co_municipio', 'desc')->first();
     if (is_null($id)) {
         return "{}";
     } else {
         return $id;
     }
 }
示例#3
0
 public function getMunicipios($idDepartamento)
 {
     return Municipio::select("*")->where("idDepartamento", $idDepartamento)->get();
 }