/** * Display a listing of the resource. * * @return Response */ public function index($id = null) { if ($id == null) { $data['ciudades'] = Ciudad::with('Departamento')->orderBy('id', 'asc')->get(); $data['departamentos'] = Departamento::orderBy('id', 'asc')->get(); return $data; } else { return $this->show($id); } }
public function getDepartamentos() { $departamentos = Departamento::orderBy('nombre')->get(); return $departamentos; }