/**
  * @return \yii\db\ActiveQuery
  */
 public function getIniciativa()
 {
     return $this->hasOne(Iniciativa::className(), ['id' => 'iniciativa_id']);
 }
 /**
  * Finds the Iniciativa model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Iniciativa the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Iniciativa::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * Displays a single Diputado model.
  * @param integer $id
  * @return mixed
  */
 public function actionView($id)
 {
     $dataProvider = new ActiveDataProvider(['query' => Iniciativa::find()]);
     // $dataProvider = new Iniciativa();
     return $this->render('view', ['model' => $this->findModel($id), 'dataProvider' => $dataProvider]);
 }
 public function actionIndex()
 {
     $date = date('Y-m-d');
     $dataProvider = new ActiveDataProvider(['query' => Iniciativa::find()->where(['>', 'fecha', $date])->limit(10)->orderBy('fecha ASC')]);
     return $this->render('index', ['dataProvider' => $dataProvider, 'date' => $date]);
 }