public function getCiudades() { $departmentId = Input::get('departamento_id'); $department = NULL; if (!is_null($departmentId)) { $department = Departamento::with('Ciudad')->find($departmentId); } return Response::json(array('ciudades' => $department->ciudades)); }
/** * Display a listing of the resource. * * @return Response */ public function index($id = null) { if ($id == null) { $data['departamentos'] = Departamento::with('pais')->orderBy('id', 'asc')->get(); $data['paises'] = Pais::orderBy('id', 'asc')->get(); return $data; } else { return $this->show($id); } }