/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = BudgetYear::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, 'start_date' => $this->start_date, 'end_date' => $this->end_date, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by]);
     $query->andFilterWhere(['like', 'year', $this->year])->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
use kartik\widgets\DatePicker;
use yii\helpers\ArrayHelper;
use common\models\BudgetYear;
/* @var $this yii\web\View */
/* @var $model common\models\BudgetYear */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="budget-year-form">

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

    <?php 
echo $form->field($model, 'year')->dropdownList(ArrayHelper::map(BudgetYear::find()->all(), 'id', 'year'));
?>

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

    <?php 
echo $form->field($model, 'start_date')->widget(DatePicker::classname(), ['options' => ['placeholder' => 'Enter birth date ...'], 'pluginOptions' => ['autoclose' => true]]);
?>

<?php 
echo $form->field($model, 'end_date')->widget(DatePicker::classname(), ['options' => ['placeholder' => 'Enter birth date ...'], 'pluginOptions' => ['autoclose' => true]]);
?>
    <div class="form-group">
        <?php 
 /**
  * Finds the BudgetYear model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return BudgetYear the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = BudgetYear::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }