public static function getDropList() { $data = Adver::find()->All(); $dropList = array(); if ($data) { foreach ($data as $key => $row) { $dropList[$row['id']] = $row['name']; } } return $dropList; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Adver::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, 'create_uid' => $this->create_uid, 'create_at' => $this->create_at, 'update_at' => $this->update_at]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'remark', $this->remark]); return $dataProvider; }