示例#1
0
 /**
  * Signs user up.
  *
  * @return User|null the saved model or null if saving fails
  */
 public function signup()
 {
     if ($this->validate()) {
         $user = new Customer();
         $user->username = $this->username;
         $user->email = $this->email;
         $user->setPassword($this->password);
         $user->generateAuthKey();
         if ($user->save()) {
             return $user;
         }
     }
     return null;
 }
示例#2
0
 /**
  * Finds user by [[username]]
  *
  * @return User|null
  */
 public function getCustomer()
 {
     if ($this->_customer === false) {
         $this->_customer = Customer::findByUsername($this->username);
     }
     return $this->_customer;
 }
示例#3
0
文件: Call.php 项目: jorry2008/turen
 /**
  * 一对一
  */
 public function getCustomer()
 {
     return $this->hasOne(Customer::className(), ['id' => 'customer_id']);
 }