@@ -27,9 +27,9 @@ class User extends BaseModel implements
2727 public $ primaryKey = 'user_id ' ;
2828
2929 /**
30- * @var array Relations to load implicitly by Restful controllers
30+ * @var ? array Relations to load implicitly by Restful controllers
3131 */
32- public static $ localWith = ['primaryRole ' , 'roles ' ];
32+ public static ? array $ itemWith = ['primaryRole ' , 'roles ' ];
3333
3434 /**
3535 * The attributes that are mass assignable.
@@ -52,7 +52,7 @@ class User extends BaseModel implements
5252 /**
5353 * Model's boot function
5454 */
55- public static function boot ()
55+ public static function boot (): void
5656 {
5757 parent ::boot ();
5858
@@ -69,7 +69,8 @@ public static function boot()
6969 *
7070 * @return array Rules
7171 */
72- public function getValidationRules () {
72+ public function getValidationRules (): array
73+ {
7374 return [
7475 'email ' => 'email|max:255|unique:users ' ,
7576 'name ' => 'required|min:3 ' ,
@@ -98,7 +99,8 @@ public function roles() {
9899 /**
99100 * Get all user's roles
100101 */
101- public function getRoles () {
102+ public function getRoles (): ?array
103+ {
102104 $ allRoles = array_merge (
103105 [
104106 $ this ->primaryRole ->name ,
@@ -114,7 +116,8 @@ public function getRoles() {
114116 *
115117 * @return bool
116118 */
117- public function isAdmin () {
119+ public function isAdmin (): bool
120+ {
118121 return $ this ->primaryRole ->name == Role::ROLE_ADMIN ;
119122 }
120123
@@ -124,7 +127,7 @@ public function isAdmin() {
124127 *
125128 * @return mixed
126129 */
127- public function getJWTIdentifier ()
130+ public function getJWTIdentifier (): string
128131 {
129132 return $ this ->getKey ();
130133 }
@@ -135,7 +138,7 @@ public function getJWTIdentifier()
135138 *
136139 * @return array
137140 */
138- public function getJWTCustomClaims ()
141+ public function getJWTCustomClaims (): array
139142 {
140143 return [
141144 'user ' => [
@@ -151,7 +154,7 @@ public function getJWTCustomClaims()
151154 *
152155 * @return string
153156 */
154- public function getAuthIdentifierName ()
157+ public function getAuthIdentifierName (): string
155158 {
156159 return $ this ->getKeyName ();
157160 }
0 commit comments