/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Bairro::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(['id' => $this->id]); $query->andFilterWhere(['like', 'nome', $this->nome])->andFilterWhere(['like', 'zona', $this->zona])->andFilterWhere(['like', 'subBairro', $this->subBairro]); return $dataProvider; }
?> <?php echo $form->field($model, 'nome')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'pontodereferencia')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'sexo')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'bairro_id')->dropDownList(ArrayHelper::map(\frontend\models\Bairro::find()->orderBy(['nome' => SORT_ASC])->all(), 'id', 'nome'), ['prompt' => 'Selecione']); ?> <?php echo $form->field($model, 'datanascimento')->widget(DatePicker::classname(), ['options' => ['placeholder' => 'Coloque a data...'], 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']]); ?> <?php echo $form->field($model, 'rg')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'telefone')->textInput(['maxlength' => true]); ?> <?php