Skip to content

Commit bfc570b

Browse files
Update models by removing unnecessary code
1 parent feed60a commit bfc570b

File tree

1 file changed

+2
-34
lines changed

1 file changed

+2
-34
lines changed

app/Models/User.php

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,61 +7,29 @@
77
use Illuminate\Notifications\Notifiable;
88
use Laravel\Fortify\TwoFactorAuthenticatable;
99
use Laravel\Jetstream\HasProfilePhoto;
10-
use Laravel\Sanctum\HasApiTokens;
1110

1211
class User extends Authenticatable
1312
{
14-
use HasApiTokens;
1513
use HasFactory;
1614
use HasProfilePhoto;
1715
use Notifiable;
1816
use TwoFactorAuthenticatable;
1917

2018
protected $guarded = [];
2119

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-
*/
3820
protected $hidden = [
3921
'password',
4022
'remember_token',
4123
'two_factor_recovery_codes',
4224
'two_factor_secret',
4325
];
4426

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-
*/
5927
protected $appends = [
6028
'profile_photo_url',
6129
'formatted_created_at'
6230
];
6331

64-
public function getFormattedCreatedAtAttribute()
32+
public function getFormattedCreatedAtAttribute(): string
6533
{
6634
return $this->created_at->format('d M Y');
6735
}
@@ -71,7 +39,7 @@ public function role()
7139
return $this->belongsTo(Role::class);
7240
}
7341

74-
public function isAdmin()
42+
public function isAdmin(): bool
7543
{
7644
return $this->role->id == 1;
7745
}

0 commit comments

Comments
 (0)