/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Tours::find(); // add conditions that should always apply here $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; } // grid filtering conditions $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'title', $this->title]); return $dataProvider; }
/* @var $this yii\web\View */ /* @var $model app\models\ToursMeta */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="tours-meta-form"> <?php $form = ActiveForm::begin(); ?> <div class="form-group"> <?php echo Html::label('Tour name'); ?> <?php echo Html::activeDropDownList($model, 'tour_id', ArrayHelper::map(\app\models\Tours::find()->all(), 'id', 'title'), ['class' => 'form-control']); ?> </div> <?php echo $form->field($model, 'tour_key')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'tour_value')->dropDownList(['int' => 'Integer', 'string' => 'String']); ?> <?php echo $form->field($model, 'description')->textInput(['maxlength' => true]); ?>
public function actionManageTours() { $dataProvider = new ActiveDataProvider(['query' => Tours::find()]); return $this->render('manage_tours', ['dataProvider' => $dataProvider]); }
/** * actionIndex * @param unknown $to */ public function actionIndex() { $provider = new ActiveDataProvider(['query' => Tours::find()->with(['hotelFk', 'hotelFk.hotelFeatures', 'hotelFk.hotelFeatures.featuresFk'])->asArray(), 'pagination' => ['pageSize' => 2]]); return $provider; }