diff --git a/models/Customer.php b/models/Customer.php index f5c0ce4..5337d37 100755 --- a/models/Customer.php +++ b/models/Customer.php @@ -12,7 +12,6 @@ * @property integer $id * @property string $username * @property string $password_hash - * @property string $name * @property string $surname * @property string $phone * @property string $gender @@ -58,9 +57,6 @@ ], [ [ - 'birth_day', - 'birth_month', - 'birth_year', 'group_id', 'status', 'created_at', @@ -79,8 +75,8 @@ ], [ [ + 'birthday', 'username', - 'name', 'surname', 'phone', 'email', @@ -108,13 +104,10 @@ return [ 'id' => Yii::t('app', 'id'), 'username' => Yii::t('app', 'username'), - 'name' => Yii::t('app', 'cname'), 'surname' => Yii::t('app', 'surname'), 'phone' => Yii::t('app', 'phone'), 'gender' => Yii::t('app', 'gender'), - 'birth_day' => Yii::t('app', 'birth_day'), - 'birth_month' => Yii::t('app', 'birth_month'), - 'birth_year' => Yii::t('app', 'birth_year'), + 'birthday' => Yii::t('app', 'birthday'), 'body' => Yii::t('app', 'body'), 'group_id' => Yii::t('app', 'group_id'), 'email' => Yii::t('app', 'email'), @@ -152,6 +145,18 @@ { return $this->username . ' ' . $this->surname; } + + + public function beforeSave($insert) + { + if (parent::beforeSave($insert)) { + + $this->birthday = !empty($this->birthday) ? (string)strtotime($this->birthday) : ''; + return true; + } + return false; + + } public function getPassword() { -- libgit2 0.21.4