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