1 | <?php |
||
17 | class User extends Model implements AuthenticatableUserContract, Authenticatable, CanResetPasswordContract |
||
18 | { |
||
19 | use AuthenticatableTrait, Authorizable, CanResetPassword, Notifiable, EntrustUserTrait { |
||
20 | EntrustUserTrait::can insteadof Authorizable; |
||
21 | |||
22 | } |
||
23 | |||
24 | /** |
||
25 | * The attributes that are mass assignable. |
||
26 | * |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $fillable = [ |
||
30 | 'name', 'email', 'password', 'activated' |
||
31 | ]; |
||
32 | |||
33 | /** |
||
34 | * The attributes that should be hidden for arrays. |
||
35 | * |
||
36 | * @var array |
||
37 | */ |
||
38 | protected $hidden = [ |
||
39 | 'password', 'remember_token', |
||
40 | ]; |
||
41 | |||
42 | /** |
||
43 | * @return mixed |
||
44 | */ |
||
45 | public function getJWTIdentifier() |
||
46 | { |
||
47 | return $this->getKey(); // Eloquent model method |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @return array |
||
52 | */ |
||
53 | public function getJWTCustomClaims() |
||
54 | { |
||
55 | return [ |
||
56 | 'user' => [ |
||
57 | 'id' => $this->id, |
||
58 | ], |
||
59 | ]; |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * @return BelongsToMany |
||
64 | */ |
||
65 | public function roles() |
||
69 | |||
70 | /** |
||
71 | * Get the activation record associated with the user. |
||
72 | */ |
||
73 | public function activation() |
||
77 | } |
||
78 |