Esempio n. 1
0
 public function add()
 {
     $business_user = new Users();
     $business_user->username = $this->username;
     $business_user->password = Yii::$app->security->generatePasswordHash($this->password);
     $business_user->email = $this->email;
     $business_user->mobile_phone = $this->mobile_phone;
     $business_user->comments = $this->comments;
     $business_user->social_role = self::BUSINESS_ROLE;
     $p_code = Users::find()->select("MAX(`pasport_code`)+1")->where(['social_role' => self::BUSINESS_ROLE])->scalar();
     $business_user->pasport_code = $p_code ? $p_code : 1;
     $result = $business_user->save();
     if ($result) {
         return $business_user;
     } else {
         return false;
     }
 }
Esempio n. 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUser()
 {
     return $this->hasOne(Users::className(), ['id' => 'user_id']);
 }
Esempio n. 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getInternalUser()
 {
     return $this->hasOne(Users::className(), ['id' => 'internal_user']);
 }
Esempio n. 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEconomicViewedUser()
 {
     return $this->hasOne(Users::className(), ['id' => 'economic_viewed_user_id']);
 }
Esempio n. 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUsers()
 {
     return $this->hasMany(Users::className(), ['social_role_id' => 'id']);
 }
Esempio n. 6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getChild5()
 {
     return $this->hasOne(Users::className(), ['id' => 'child_5']);
 }