/** * Creates data provider instance with search query applied * @return ActiveDataProvider */ public function search() { $query = Company::find(); $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(['like', 'name', $this->name])->andFilterWhere(['like', 'address', $this->address]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Company::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, 'slider_amount' => $this->slider_amount, 'created_date' => $this->created_date, 'last_modified_date' => $this->last_modified_date]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'about_us', $this->about_us])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'longitude', $this->longitude])->andFilterWhere(['like', 'latitude', $this->latitude])->andFilterWhere(['like', 'twitter_url', $this->twitter_url])->andFilterWhere(['like', 'facebook_url', $this->facebook_url])->andFilterWhere(['like', 'instagram_url', $this->instagram_url])->andFilterWhere(['like', 'gplus_url', $this->gplus_url])->andFilterWhere(['like', 'terms_and_condition', $this->terms_and_condition])->andFilterWhere(['like', 'purchashing_guide', $this->purchashing_guide])->andFilterWhere(['like', 'payment_guide', $this->payment_guide])->andFilterWhere(['like', 'delivery_guide', $this->delivery_guide])->andFilterWhere(['like', 'return_policy', $this->return_policy])->andFilterWhere(['like', 'privacy_policy', $this->privacy_policy])->andFilterWhere(['like', 'logo_path', $this->logo_path])->andFilterWhere(['like', 'favicon_path', $this->favicon_path])->andFilterWhere(['like', 'email_1', $this->email_1])->andFilterWhere(['like', 'email_2', $this->email_2])->andFilterWhere(['like', 'meta_tag', $this->meta_tag])->andFilterWhere(['like', 'meta_description', $this->meta_description])->andFilterWhere(['like', 'created_by', $this->created_by])->andFilterWhere(['like', 'last_modified_by', $this->last_modified_by]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Company::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', 'name', $this->name])->andFilterWhere(['like', 'content', $this->content]); return $dataProvider; }
<small class="help-block"><span class="glyphicon glyphicon-info-sign"></span> Для получения информации о занятости переговрных помещений в других ВКС, дата и время совещания должны быть указаны полностью </small> <div class="form-group"> <div class="row"> <div class="col-lg-5"> <div class="btn-group-vertical btn-block" style="overflow-x: hidden; overflow-y: scroll; max-height: 300px"> <?php foreach (Company::find()->orderBy('order')->all() as $company) { ?> <?php echo Html::button($company->name, ['class' => 'btn btn-default vks-company', 'data' => ['id' => (string) $company->primaryKey, 'toggle' => 'tooltip', 'placement' => 'left', 'container' => '#vks-participants', 'title' => $company->address]]); ?> <?php } ?> </div> </div> <div class="col-lg-7">
public function searchCompanyByContact($contactUserId) { $query = Company::find()->select('company.*')->innerJoin('contact', '`company`.`id` = `contact`.`company_id`')->where(['contact.user_id' => $contactUserId]); $dataProvider = new ActiveDataProvider(['query' => $query]); return $dataProvider; }