Commit 2689758be34eefa73995ec3c514cc15a5cfd318a
1 parent
acd74908
full commit
Showing
1 changed file
with
14 additions
and
9 deletions
Show diff stats
models/Customer.php
@@ -12,7 +12,6 @@ | @@ -12,7 +12,6 @@ | ||
12 | * @property integer $id | 12 | * @property integer $id |
13 | * @property string $username | 13 | * @property string $username |
14 | * @property string $password_hash | 14 | * @property string $password_hash |
15 | - * @property string $name | ||
16 | * @property string $surname | 15 | * @property string $surname |
17 | * @property string $phone | 16 | * @property string $phone |
18 | * @property string $gender | 17 | * @property string $gender |
@@ -58,9 +57,6 @@ | @@ -58,9 +57,6 @@ | ||
58 | ], | 57 | ], |
59 | [ | 58 | [ |
60 | [ | 59 | [ |
61 | - 'birth_day', | ||
62 | - 'birth_month', | ||
63 | - 'birth_year', | ||
64 | 'group_id', | 60 | 'group_id', |
65 | 'status', | 61 | 'status', |
66 | 'created_at', | 62 | 'created_at', |
@@ -79,8 +75,8 @@ | @@ -79,8 +75,8 @@ | ||
79 | ], | 75 | ], |
80 | [ | 76 | [ |
81 | [ | 77 | [ |
78 | + 'birthday', | ||
82 | 'username', | 79 | 'username', |
83 | - 'name', | ||
84 | 'surname', | 80 | 'surname', |
85 | 'phone', | 81 | 'phone', |
86 | 'email', | 82 | 'email', |
@@ -108,13 +104,10 @@ | @@ -108,13 +104,10 @@ | ||
108 | return [ | 104 | return [ |
109 | 'id' => Yii::t('app', 'id'), | 105 | 'id' => Yii::t('app', 'id'), |
110 | 'username' => Yii::t('app', 'username'), | 106 | 'username' => Yii::t('app', 'username'), |
111 | - 'name' => Yii::t('app', 'cname'), | ||
112 | 'surname' => Yii::t('app', 'surname'), | 107 | 'surname' => Yii::t('app', 'surname'), |
113 | 'phone' => Yii::t('app', 'phone'), | 108 | 'phone' => Yii::t('app', 'phone'), |
114 | 'gender' => Yii::t('app', 'gender'), | 109 | 'gender' => Yii::t('app', 'gender'), |
115 | - 'birth_day' => Yii::t('app', 'birth_day'), | ||
116 | - 'birth_month' => Yii::t('app', 'birth_month'), | ||
117 | - 'birth_year' => Yii::t('app', 'birth_year'), | 110 | + 'birthday' => Yii::t('app', 'birthday'), |
118 | 'body' => Yii::t('app', 'body'), | 111 | 'body' => Yii::t('app', 'body'), |
119 | 'group_id' => Yii::t('app', 'group_id'), | 112 | 'group_id' => Yii::t('app', 'group_id'), |
120 | 'email' => Yii::t('app', 'email'), | 113 | 'email' => Yii::t('app', 'email'), |
@@ -152,6 +145,18 @@ | @@ -152,6 +145,18 @@ | ||
152 | { | 145 | { |
153 | return $this->username . ' ' . $this->surname; | 146 | return $this->username . ' ' . $this->surname; |
154 | } | 147 | } |
148 | + | ||
149 | + | ||
150 | + public function beforeSave($insert) | ||
151 | + { | ||
152 | + if (parent::beforeSave($insert)) { | ||
153 | + | ||
154 | + $this->birthday = !empty($this->birthday) ? (string)strtotime($this->birthday) : ''; | ||
155 | + return true; | ||
156 | + } | ||
157 | + return false; | ||
158 | + | ||
159 | + } | ||
155 | 160 | ||
156 | public function getPassword() | 161 | public function getPassword() |
157 | { | 162 | { |