예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Account::find()->salons();
     $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, 'city_id' => $this->city_id, 'lastLoginAt' => $this->lastLoginAt, 'createdAt' => $this->createdAt, 'updatedAt' => $this->updatedAt, 'status' => $this->status, 'balance' => $this->balance]);
     if ($this->getScenario() !== 'moderate') {
         $query->andFilterWhere(['like', 'slug_url', $this->slug_url]);
     }
     $query->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'password', $this->password])->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token])->andFilterWhere(['like', 'authKey', $this->authKey])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'url', $this->url])->andFilterWhere(['like', 'xy', $this->xy])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'thumb', $this->thumb])->andFilterWhere(['like', 'city_name', $this->city_name])->andFilterWhere(['like', 'place_delivery', $this->place_delivery])->andFilterWhere(['like', 'other', $this->other])->andFilterWhere(['like', 'contract', $this->contract])->andFilterWhere(['like', 'is_moderated', $this->is_moderated])->andFilterWhere(['like', 'is_salon', $this->is_salon]);
     // Create a command. You can get the actual SQL using $command->sql
     $command = $query->createCommand();
     return $dataProvider;
 }
예제 #2
0
 public function actionUpSlug()
 {
     $systems = SystemAuto::find()->all();
     foreach ($systems as $model) {
         $model->save();
     }
     $systems = Account::find()->all();
     foreach ($systems as $model) {
         $model->save();
     }
 }
예제 #3
0
 public static function getSalonsListModels($city_name = false, $top = false)
 {
     if ($top) {
         return Account::find()->andFilterWhere(["is_moderated" => '2', "city_name" => $city_name])->andWhere('balance > "-1"')->andWhere('count_autos > "0"')->limit(6)->orderBy(['balance' => SORT_DESC, 'username' => SORT_ASC])->all();
     } else {
         return Account::find()->andFilterWhere(["is_moderated" => '2', "city_name" => $city_name])->orderBy(['balance' => SORT_DESC, 'username' => SORT_ASC])->all();
     }
 }