Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
?>

    <?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 
Exemplo n.º 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBairro()
 {
     return $this->hasOne(Bairro::className(), ['id' => 'bairro_id']);
 }
Exemplo n.º 4
0
 /**
  * Finds the Bairro model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Bairro the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Bairro::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }