commit | author | age
|
9f6455
|
1 |
<?php |
DC |
2 |
|
|
3 |
namespace App\Models; |
|
4 |
|
|
5 |
use Illuminate\Contracts\Auth\MustVerifyEmail; |
|
6 |
use Illuminate\Database\Eloquent\Factories\HasFactory; |
|
7 |
use Illuminate\Foundation\Auth\User as Authenticatable; |
|
8 |
use Illuminate\Notifications\Notifiable; |
|
9 |
use Laravel\Sanctum\HasApiTokens; |
|
10 |
use Tymon\JWTAuth\Contracts\JWTSubject; |
|
11 |
|
|
12 |
class User extends Authenticatable implements JWTSubject |
|
13 |
{ |
|
14 |
use HasApiTokens, HasFactory, Notifiable; |
|
15 |
|
|
16 |
/** |
|
17 |
* The attributes that are mass assignable. |
|
18 |
* |
|
19 |
* @var array<int, string> |
|
20 |
*/ |
|
21 |
protected $fillable = [ |
|
22 |
'username', |
|
23 |
'email', |
|
24 |
'password', |
|
25 |
]; |
|
26 |
|
|
27 |
/** |
|
28 |
* The attributes that should be hidden for serialization. |
|
29 |
* |
|
30 |
* @var array<int, string> |
|
31 |
*/ |
|
32 |
protected $hidden = [ |
|
33 |
'password', |
|
34 |
'remember_token', |
|
35 |
]; |
|
36 |
|
|
37 |
/** |
|
38 |
* The attributes that should be cast. |
|
39 |
* |
|
40 |
* @var array<string, string> |
|
41 |
*/ |
|
42 |
protected $casts = [ |
|
43 |
'email_verified_at' => 'datetime', |
|
44 |
]; |
|
45 |
|
|
46 |
/** |
|
47 |
* Get the identifier that will be stored in the subject claim of the JWT. |
|
48 |
* |
|
49 |
* @return mixed |
|
50 |
*/ |
|
51 |
public function getJWTIdentifier(): mixed |
|
52 |
{ |
|
53 |
return $this->getKey(); |
|
54 |
} |
|
55 |
|
|
56 |
/** |
|
57 |
* Return a key value array, containing any custom claims to be added to the JWT. |
|
58 |
* |
|
59 |
* @return array |
|
60 |
*/ |
|
61 |
public function getJWTCustomClaims(): array |
|
62 |
{ |
|
63 |
return []; |
|
64 |
} |
|
65 |
|
|
66 |
} |