/** * Creates data provider instance with search query applied * @return ActiveDataProvider */ public function search($params) { $query = Feedback::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'slug' => $this->slug, 'author_id' => $this->author_id, 'category_id' => $this->category_id, 'updater_id' => $this->updater_id, 'status' => $this->status, 'published_at' => $this->published_at, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'message', $this->message])->andFilterWhere(['like', 'lang', $this->lang])->andFilterWhere(['like', 'weight', $this->weight])->andFilterWhere(['like', 'body', $this->body]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Feedback::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, 'activity_id' => $this->activity_id, 'offer_id' => $this->offer_id, 'agreement_id' => $this->agreement_id]); return $dataProvider; }
public function actionEnum($domain_type) { $membersArray = Feedback::find()->published()->andWhere(['like', 'domain', Yii::getAlias('@frontendUrl_' . $domain_type)])->all(); $enum = []; $enumTitles = []; foreach ($membersArray as $k => $v) { $enum[] = $v->title . ' #' . $v->id; } //\yii\helpers\VarDumper::dump($members,11,1); die(); Yii::$app->response->data = ["items" => ["type" => "string", "enum" => $enum]]; Yii::$app->response->format = yii\web\Response::FORMAT_JSON; return Yii::$app->response; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Feedback::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, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'type', $this->type])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'content', $this->content]); return $dataProvider; }
/** * Creates data provider instance with search query applied * @return ActiveDataProvider */ public function search($params) { $query = Feedback::find(); $query->joinWith(['author']); if (!\Yii::$app->user->can('administrator')) { $query->andWhere(['domain_id' => \Yii::$app->user->identity->id]); } $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'domain_id' => $this->domain_id]); if ($this->search_date_created != '') { $this->data_begin_created = strtotime($this->search_date_created); $this->data_end_created = strtotime($this->search_date_created) + 24 * 60 * 60; } $query->andFilterWhere(['like', 'text', $this->text])->andFilterWhere(['like', 'subject', $this->subject])->andFilterWhere(['between', 'feedback_form.created_at', $this->data_begin_created, $this->data_end_created])->andFilterWhere(['like', 'user.username', $this->author]); return $dataProvider; }