/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Myaddress::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, 'created_at' => $this->created_at]);
     $query->andFilterWhere(['like', 'firstname', $this->firstname])->andFilterWhere(['like', 'middlename', $this->middlename])->andFilterWhere(['like', 'lastname', $this->lastname])->andFilterWhere(['like', 'gender', $this->gender])->andFilterWhere(['like', 'home_address', $this->home_address])->andFilterWhere(['like', 'landline', $this->landline])->andFilterWhere(['like', 'cellphone', $this->cellphone]);
     return $dataProvider;
 }
 /**
  * Lists all Myaddress models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Myaddress::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use app\models\Myaddress;
/* @var $this yii\web\View */
/* @var $model app\models\Mycomment */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="mycomment-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'myaddress_id')->dropDownList(ArrayHelper::map(Myaddress::find()->all(), 'id', 'lastname'));
?>

    <?php 
echo $form->field($model, 'author')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'body')->textarea(['rows' => 6]);
?>

    <?php 
echo $form->field($model, 'created_at')->textInput();
?>

    <div class="form-group">
Ejemplo n.º 4
0
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use app\models\Myaddress;
/* @var $this yii\web\View */
/* @var $model app\models\Mycomment */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="mycomment-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'myaddress_id')->dropDownList(ArrayHelper::map(Myaddress::find()->all(), 'id', 'lastname'), ['prompt' => 'Select Name']);
?>

    <?php 
echo $form->field($model, 'author')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'body')->textarea(['rows' => 6]);
?>

    <?php 
echo $form->field($model, 'created_at')->textInput();
?>

    <div class="form-group">