/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = BudgetTier::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, 'level' => $this->level]); $query->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; }
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; use app\models\BudgetTier; $dataList = ArrayHelper::map(BudgetTier::find()->asArray()->all(), 'id', 'description'); /* @var $this yii\web\View */ /* @var $model app\models\Lead */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="lead-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'company')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'company_url')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php