/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Car::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(['id' => $this->id, 'brand_id' => $this->brand_id, 'model_id' => $this->model_id, 'fuel_id' => $this->fuel_id, 'type_id' => $this->type_id, 'deleted' => 0]); $query->andFilterWhere(['like', 'description', $this->description], ['like', 'extras', $this->extras]); return $dataProvider; }
public function actionImageids($id) { $model = Car::findOne($id); $images = $model->imagesList; $res = ''; if ($images) { foreach ($images as $key => $value) { $res .= "<option value='" . $value . "'>" . $value . "</option>"; } } else { $res = "<option>-</option>"; } return json_encode($res); }
public function actionView($id) { $model = Car::findOne($id); return $this->render('_view', ['model' => $model]); }