/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Item::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['item_no' => $this->item_no, 'max_life_time' => $this->max_life_time, 'current_life_time' => $this->current_life_time, 'hourly_price' => $this->hourly_price]); $query->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'model', $this->model])->andFilterWhere(['like', 'manufaturer', $this->manufaturer])->andFilterWhere(['like', 'type', $this->type]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Item::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->joinWith('category'); $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'itemname', $this->itemname])->andFilterWhere(['like', 'category.name', $this->categoryID]); return $dataProvider; }
<?php echo $form->field($event, 'end_date_time')->widget(DateTimePicker::className(), ['language' => 'english', 'pickButtonIcon' => 'glyphicon glyphicon-time', 'inline' => false, 'clientOptions' => ['autoclose' => true, 'linkFormat' => 'HH:ii P', 'todayBtn' => false]]); ?> <?php echo $form->field($event, 'type')->dropDownList(['Wedding' => 'Wedding', 'Party' => 'Party', 'Meeting' => 'Meeting', 'Religious event' => 'Religious event', 'Other' => 'Other'], ['prompt' => '']); ?> <?php echo $form->field($model, 'item_1')->dropDownList(ArrayHelper::map(Item::find()->all(), 'type', 'type'), ['prompt' => 'Select item']); ?> <?php echo $form->field($model, 'qtyItem_1')->textInput(); ?> <?php echo $form->field($model, 'advanced_payment')->textInput(); ?>