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