Example #1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDptoNombre()
 {
     return $this->hasOne(Dpto::className(), ['nombre' => 'dpto_nombre']);
 }
Example #2
0
use kartik\select2\Select2;
use app\models\Dpto;
?>

<div class="staff-form">

    <?php 
$form = ActiveForm::begin(['enableAjaxValidation' => true]);
?>
     <div class="col-md-4"><?php 
echo $form->field($model, 'nombre')->textInput(['maxlength' => true]);
?>
</div>
   
     <div class="col-md-4"><?php 
echo $form->field($model, 'dpto_nombre')->widget(Select2::classname(), ['data' => ArrayHelper::map(Dpto::find()->all(), 'nombre', 'nombre'), 'language' => 'en', 'hideSearch' => true, 'options' => ['placeholder' => 'Selecciona un departamento'], 'pluginOptions' => ['allowClear' => true]]);
?>
</div>
   
     <div class="col-md-4"><?php 
echo $form->field($model, 'apellido1')->textInput(['maxlength' => true]);
?>
</div>
     <div class="col-md-4"><?php 
echo $form->field($model, 'apellido2')->textInput(['maxlength' => true]);
?>
</div>
     <div class="col-md-4"><?php 
echo $form->field($model, 'rut')->textInput(['maxlength' => true]);
?>
</div>