/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(LocalidadRequestCreate $request) { $localidad = new Localidad($request->all()); $localidad->save(); Flash::success('La localidad "' . $localidad->nombre . '" ha sido registrada de forma existosa.'); return redirect()->route('admin.localidades.index'); }
/** * Bind data to the view. * * @param View $view * @return void */ public function compose(View $view) { $empresaslista = Empresa::orderBy('nombre', 'ASC')->lists('nombre', 'nombre'); $localidades = Localidad::orderBy('nombre', 'ASC')->lists('nombre', 'id'); $rubros = Rubro::orderBy('nombre', 'ASC')->lists('nombre', 'id'); $view->with('rubros', json_decode($rubros, true))->with('empresaslista', json_decode($empresaslista, true))->with('localidades', json_decode($localidades, true)); }
/** * * @return a list of objects. */ public static function listByFullName() { $items = Localidad::where('id', '92')->orWhere('id', '254')->get(); $key = 'id'; $value = 'full_name'; return Localidad::getListFields($items, $key, $value); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $whereAmI = $this->ruta . $this->listOneBreadcrumb('crear persona', '', 1); $localidades = Localidad::listByFullName(); $data = ['whereAmI' => $whereAmI, 'localidades' => $localidades]; return view('admin.people.personas.create', $data); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $whereAmI = $this->ruta . $this->listOneBreadcrumb('editar calle', '', 1); $calle = Calle::with('localidad')->with('localidad.departamento')->with('localidad.departamento.provincia')->with('localidad.departamento.provincia.pais')->findOrFail($id); $localidades = Localidad::listByFullName(); $data = ['whereAmI' => $whereAmI, 'calle' => $calle, 'localidades' => $localidades]; return view('admin.cities.calles.edit', $data); }
/** * Bind data to the view. * * @param View $view * @return void */ public function compose(View $view) { $productoslista = Producto::orderBy('nombre', 'ASC')->lists('nombre', 'nombre'); $marcas = Marca::orderBy('nombre', 'ASC')->lists('nombre', 'id'); $tipos = Tipoproducto::orderBy('nombreTipo', 'ASC')->lists('nombreTipo', 'id'); $localidades = Localidad::orderBy('nombre', 'ASC')->lists('nombre', 'id'); $view->with('marcas', json_decode($marcas, true))->with('tipos', json_decode($tipos, true))->with('localidades', json_decode($localidades, true))->with('productoslista', json_decode($productoslista, true)); }
public function localidad($nombre_provincia, $nombre_localidad) { $provincia = Provincia::where('slug', '=', $nombre_provincia)->first(); $localidad = Localidad::where('slug', '=', $nombre_localidad)->first(); $consultorios = $localidad->consultorios_y_medicos()->paginate(50); $breadcrum = [["url" => "provicias", "texto" => "Provincias"], ["url" => "provicias/" . $provincia->slug, "texto" => $provincia->nombre]]; return view('listados.localidad', ["provincia" => $provincia, "localidad" => $localidad, "consultorios" => $consultorios, "titulo" => $localidad->nombre, "breadcrum" => $breadcrum]); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $whereAmI = $this->ruta . $this->listOneBreadcrumb('editar calle', '', 1); $calle = Calle::with('localidad')->with('localidad.departamento')->with('localidad.departamento.provincia')->with('localidad.departamento.provincia.pais')->findOrFail($id); $localidades = Localidad::listByFullName(); $data = array_merge(['webpage' => $this->webpage, 'whereAmI' => $whereAmI, 'calle' => $calle, 'localidades' => $localidades], $this->data); $this->webpage['routes'] = json_encode(getUriByController()); return view('admin.cities.calles.edit', $data); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { die; $paises = Pais::all(); $provincias = Provincia::all(); $departamentos = Departamento::all(); $localidades = Localidad::all(); $calles = Calle::all(); $domicilios = Domicilio::all(); $telefonos = Telefono::all(); $emails = Email::all(); $webs = Web::all(); }
public function autocomplete($tipo = null) { $data = Input::all(); $term = "%" . $data["term"] . "%"; $listado = []; if ($tipo == 'medicos' || $tipo == null) { $medicos = Medico::where('nombre', 'like', $term)->orWhere("apellido", 'like', $term)->get(); foreach ($medicos as $medico) { $listado[] = ["label" => $medico->titu_nom_ape, "category" => "Profesionales", "url" => $medico->url]; } } if ($tipo == 'especialidades' || $tipo == null) { $especialidades = Especialidad::where('nombre', 'like', $term)->get(); foreach ($especialidades as $especialidad) { $listado[] = ["label" => $especialidad->nombre, "category" => "Especialidades", "url" => $especialidad->url]; } } if ($tipo == 'enfermedades' || $tipo == null) { $enfermedades = Enfermedad::where('nombre', 'like', $term)->get(); foreach ($enfermedades as $enfermedad) { $listado[] = ["label" => $enfermedad->nombre, "category" => "Enfermedades", "url" => $enfermedad->url]; } } if ($tipo == 'localidades' || $tipo == null) { $localidades = Localidad::where('nombre', 'like', $term)->get(); foreach ($localidades as $localidad) { $listado[] = ["label" => $localidad->provincia_nombre, "category" => "Localidades", "url" => $localidad->url, 'id' => $localidad->id]; } } if ($tipo == 'provincias' || $tipo == null) { $provincias = Provincia::where('nombre', 'like', $term)->get(); foreach ($provincias as $provincia) { $listado[] = ["label" => $provincia->nombre, "category" => "Provincias", "url" => $provincia->url]; } } return response()->json($listado); }
/** * * @return a list of objects. */ public static function listByFullName($pais_id = 0) { if (isset($pais_id) and $pais_id > 0) { $items = Localidad::has('departamento.provincia.pais', $pais_id)->get(); } else { $items = Localidad::where('id', 92)->get(); } $key = 'id'; $value = 'full_name'; return Localidad::getListFields($items, $key, $value); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $ciudades = Localidad::listByFullName(); $estadio = Estadio::with('club')->with('domicilio')->findOrFail($id); $this->webpage['whereAmI'] .= $this->listOneBreadcrumb('editar ' . $this->modelo, '', 1); $this->webpage['tab_title'] .= ' - Editar - ' . $estadio->full_name; $this->data = array_merge(['webpage' => $this->webpage, 'estadio' => $estadio, 'localidades' => $ciudades], $this->data); return view('admin.people.estadios.edit', $this->data); }
public function filterbystate($id) { $ciudades = Localidad::where('municipio_id', $id)->get(); return Response()->json($ciudades); }
public function search() { //DB::enableQueryLog(); $search_text = trim(Input::get("text")); $result = Localidad::where("nombre", 'LIKE', '%' . $search_text . '%')->orWhere("codigo_postal", 'LIKE', '%' . $search_text . '%')->get(); $results = []; foreach ($result as $localidad) { $localidad->full_name = $localidad->full_name; $results[] = $localidad; } //dd(DB::getQueryLog()); return response()->json(['result' => 'Ok', 'response' => $results]); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $localidad = Localidad::findOrFail($id); // $localidad->delete(); Session::flash('message', 'No se puede eliminar la localidad ' . $localidad->full_name); return \Redirect::route('cities.localidades.index'); }
#=== cities =============================================================================== #========================================================================================== Route::resource('cities/localidades', 'cities\\LocalidadController'); Route::resource('cities/calles', 'cities\\CalleController'); Route::get('/cities/localidades/pais/{id}', function ($id) { return response()->json(['result' => 'Ok', 'response' => Localidad::listByFullName($id)]); }); Route::get('/search/localidades', ['as' => 'cities.localidades.search', 'uses' => 'cities\\LocalidadController@search']); #========================================================================================== #=== users & home ========================================================================= #========================================================================================== Route::get('home', ['as' => 'home', function () { $webpage = ['tab_title' => 'Inicio', 'active' => 'home', 'whereAmI' => '', 'routes_json' => json_encode(getUriByController()), 'routes' => getUriByController()]; $generos = App\Genero::listByFullName(); $paises = App\Pais::listByFullName(); $ciudades = App\Localidad::listByFullName(); $tdocs = App\TiposDocumentos::listByFullName(1); $entidades = App\Entidad::get(); $data = ['webpage' => $webpage, 'generos' => $generos, 'paises' => $paises, 'localidades' => $ciudades, 'tipos_documentos' => $tdocs, 'entidades' => $entidades]; return view('admin/home', $data); }]); /*Route::get('/tipos_documentos', function () { //DB::enableQueryLog(); $q = Input::get("pais"); $tipos = []; if ($q){ $tipos = TiposDocumentos::where("pais_id","=",$q)->get(); } $result["tipos_documentos"] = $tipos; return response()->json(['result' => 'Ok','response' => $result ]); });*/