コード例 #1
0
 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));
 }
コード例 #2
0
ファイル: Departamentos.php プロジェクト: crispaez/arterisk
 /**
  * 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);
     }
 }