/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Especialidad::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['idEspecialidad' => $this->idEspecialidad]); $query->andFilterWhere(['like', 'nombree', $this->nombree]); return $dataProvider; }
<?php echo $form->field($model, 'telefono')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'celular')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'correo')->textInput(['maxlength' => 50, 'placeholder' => '*****@*****.**']); ?> <?php echo $form->field($model, 'idEspecialidad')->widget(Select2::classname(), ['data' => ArrayHelper::map(Especialidad::find()->all(), 'idEspecialidad', 'nombree'), 'language' => 'en', 'options' => ['placeholder' => ''], 'pluginOptions' => ['allowClear' => true]]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Guardar' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>