/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $this->load($params); $query = Url::find()->where(['st_id' => $params['id']]); $dataProvider = new ActiveDataProvider(['query' => $query]); 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(['url_id' => $this->url_id, 'url_rot' => $this->url_rot, 'st_id' => $this->st_id]); $query->andFilterWhere(['like', 'url_url', $this->url_url])->andFilterWhere(['like', 'url_name', $this->url_name])->andFilterWhere(['like', 'url_comment', $this->url_comment]); return $dataProvider; }
/** * @getUserLink * */ public function getUserLink() { $url = Url::to(['user/view', 'id' => $this->id]); $options = []; return Html::a($this->username, $url, $options); }
/** * Finds the Url model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Url the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Url::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }