1 | <?php |
||
25 | class User extends BaseModel implements Authenticatable, Authorizable |
||
26 | { |
||
27 | use HasApiTokens; |
||
28 | use HasRoles; |
||
29 | use AuthorizableTrait; |
||
30 | |||
31 | /** |
||
32 | * The attributes excluded from the model's JSON form. |
||
33 | * |
||
34 | * @var array |
||
35 | */ |
||
36 | protected $hidden = ['password', 'remember_token']; |
||
37 | |||
38 | protected $attributes = [ |
||
39 | 'language' => 'en', |
||
40 | ]; |
||
41 | |||
42 | protected $appends = ['assigned_permissions']; |
||
43 | |||
44 | /** |
||
45 | * The column name of the "remember me" token. |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | protected $rememberTokenName = 'remember_token'; |
||
50 | |||
51 | protected static function boot() |
||
64 | |||
65 | /** |
||
66 | * Get the name of the unique identifier for the user. |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | public function getAuthIdentifierName() |
||
74 | |||
75 | /** |
||
76 | * Get the unique identifier for the user. |
||
77 | * |
||
78 | * @return mixed |
||
79 | */ |
||
80 | public function getAuthIdentifier() |
||
84 | |||
85 | /** |
||
86 | * Get the password for the user. |
||
87 | * |
||
88 | * @return string |
||
89 | */ |
||
90 | public function getAuthPassword() |
||
94 | |||
95 | /** |
||
96 | * Get the token value for the "remember me" session. |
||
97 | * |
||
98 | * @return string|null |
||
99 | */ |
||
100 | public function getRememberToken() |
||
106 | |||
107 | /** |
||
108 | * Set the token value for the "remember me" session. |
||
109 | * |
||
110 | * @param string $value |
||
111 | * @return void |
||
112 | */ |
||
113 | public function setRememberToken($value) |
||
119 | |||
120 | /** |
||
121 | * Get the column name for the "remember me" token. |
||
122 | * |
||
123 | * @return string |
||
124 | */ |
||
125 | public function getRememberTokenName() |
||
129 | |||
130 | /** |
||
131 | * Get the author's avatar. |
||
132 | * |
||
133 | * @param string $value |
||
134 | * @return string |
||
135 | */ |
||
136 | public function getAvatarAttribute($value) |
||
142 | |||
143 | public function setPasswordAttribute($value) |
||
147 | |||
148 | /** |
||
149 | * Get all permission names that are assigned to the current user. |
||
150 | */ |
||
151 | public function getAssignedPermissionsAttribute() |
||
160 | } |
||
161 |