public function beforeSave($insert) { if (parent::beforeSave($insert)) { //ssn加密 if ($this->social_security_number) { $this->social_security_number = Aes::encode($this->social_security_number); } } return true; }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { //applicant创建时与client同步数据 if ($insert) { $clientModel = $this->client; $this->load([$this->formName() => $clientModel->getAttributes()]); } $this->date_of_birth = is_numeric($this->date_of_birth) ? $this->date_of_birth : strtotime($this->date_of_birth); $this->identification_expiration_date = is_numeric($this->identification_expiration_date) ? $this->identification_expiration_date : strtotime($this->identification_expiration_date); //ssn加密 if ($this->social_security_number) { $this->social_security_number = Aes::encode($this->social_security_number); } } return true; }