public function actionLinkurl($id) { $model = Stream::find()->where(['pr_id' => $id])->orderBy('st_cnt')->one(); if (!$model) { return false; } Stream::addCounter($model->st_id); header("Location:" . $model->st_url); //return $model->st_url; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $this->load($params); $query = Stream::find()->where(['pr_id' => $params['id']]); $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(['st_id' => $this->st_id, 'pr_id' => $this->pr_id]); $query->andFilterWhere(['like', 'st_name', $this->st_name]); return $dataProvider; }
public static function getStreamFilter() { $droptions = Stream::find()->asArray()->all(); return Arrayhelper::map($droptions, 'st_name', 'st_name'); }