Example #1
0
 public function beforeSave($insert)
 {
     $this->updatedon = date('Y-m-d H:i:s', time());
     if (UserProfile::find()->count() < 30) {
         return true;
     }
     return false;
 }
Example #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = UserProfile::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'fullname', $this->fullname])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'country', $this->country])->andFilterWhere(['like', 'city', $this->city])->andFilterWhere(['like', 'state', $this->state])->andFilterWhere(['like', 'zip', $this->zip])->andFilterWhere(['like', 'website', $this->website])->andFilterWhere(['like', 'skype', $this->skype])->andFilterWhere(['like', 'image', $this->image]);
     return $dataProvider;
 }