1 | <?php |
||
14 | class UserModel extends BaseUserModel |
||
15 | { |
||
16 | /** |
||
17 | * @var string password field |
||
18 | */ |
||
19 | public $password; |
||
20 | |||
21 | /** |
||
22 | * Returns the validation rules for attributes. |
||
23 | * |
||
24 | * Validation rules are used by [[validate()]] to check if attribute values are valid. |
||
25 | * Child classes may override this method to declare different validation rules. |
||
26 | * @return array validation rules |
||
27 | * @see scenarios() |
||
28 | */ |
||
29 | public function rules() |
||
41 | |||
42 | /** |
||
43 | * Returns the attribute labels. |
||
44 | * |
||
45 | * Attribute labels are mainly used for display purpose. For example, given an attribute |
||
46 | * `firstName`, we can declare a label `First Name` which is more user-friendly and can |
||
47 | * be displayed to end users. |
||
48 | * |
||
49 | * @return array attribute labels (name => label) |
||
50 | */ |
||
51 | public function attributeLabels() |
||
57 | |||
58 | /** |
||
59 | * update user password when new password not blank. |
||
60 | * |
||
61 | */ |
||
62 | |||
63 | public function beforeSave($insert) |
||
74 | |||
75 | /** |
||
76 | * Returns a list of scenarios and the corresponding active attributes. |
||
77 | * @return array |
||
78 | */ |
||
79 | public function scenarios() |
||
84 | |||
85 | /** |
||
86 | * Create user |
||
87 | * @return UserModel|null the saved model or null if saving fails |
||
88 | */ |
||
89 | public function createUser() |
||
104 | |||
105 | } |
||
106 |