7
7
use Illuminate \Notifications \Notifiable ;
8
8
use Laravel \Fortify \TwoFactorAuthenticatable ;
9
9
use Laravel \Jetstream \HasProfilePhoto ;
10
- use Laravel \Sanctum \HasApiTokens ;
11
10
12
11
class User extends Authenticatable
13
12
{
14
- use HasApiTokens;
15
13
use HasFactory;
16
14
use HasProfilePhoto;
17
15
use Notifiable;
18
16
use TwoFactorAuthenticatable;
19
17
20
18
protected $ guarded = [];
21
19
22
- /**
23
- * The attributes that are mass assignable.
24
- *
25
- * @var array<int, string>
26
- */
27
- // protected $fillable = [
28
- // 'name',
29
- // 'email',
30
- // 'password',
31
- // ];
32
-
33
- /**
34
- * The attributes that should be hidden for serialization.
35
- *
36
- * @var array<int, string>
37
- */
38
20
protected $ hidden = [
39
21
'password ' ,
40
22
'remember_token ' ,
41
23
'two_factor_recovery_codes ' ,
42
24
'two_factor_secret ' ,
43
25
];
44
26
45
- /**
46
- * The attributes that should be cast.
47
- *
48
- * @var array<string, string>
49
- */
50
- protected $ casts = [
51
- 'email_verified_at ' => 'datetime ' ,
52
- ];
53
-
54
- /**
55
- * The accessors to append to the model's array form.
56
- *
57
- * @var array<int, string>
58
- */
59
27
protected $ appends = [
60
28
'profile_photo_url ' ,
61
29
'formatted_created_at '
62
30
];
63
31
64
- public function getFormattedCreatedAtAttribute ()
32
+ public function getFormattedCreatedAtAttribute (): string
65
33
{
66
34
return $ this ->created_at ->format ('d M Y ' );
67
35
}
@@ -71,7 +39,7 @@ public function role()
71
39
return $ this ->belongsTo (Role::class);
72
40
}
73
41
74
- public function isAdmin ()
42
+ public function isAdmin (): bool
75
43
{
76
44
return $ this ->role ->id == 1 ;
77
45
}
0 commit comments