Skip to content

Commit

Permalink
- Changed User casts to cast method
Browse files Browse the repository at this point in the history
  • Loading branch information
dash8x committed May 6, 2024
1 parent 529c3b6 commit 20daf89
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions src/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,6 @@ abstract class User extends Authenticatable implements AdminModel, HasMedia, Mus
'email',
];

/**
* The attributes that are cast to native types
*
* @var array
*/
protected $casts = [
'name' => 'string',
'email' => 'string',
'email_verified_at' => 'datetime',
'last_login_at' => 'datetime',
'login_attempts' => 'integer',
'require_password_update' => 'boolean',
'status' => UserStatuses::class,
'new_email' => 'string',
];

/**
* The searchable attributes
*
Expand All @@ -118,6 +102,25 @@ abstract class User extends Authenticatable implements AdminModel, HasMedia, Mus
'email',
];

/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'name' => 'string',
'email' => 'string',
'email_verified_at' => 'datetime',
'last_login_at' => 'datetime',
'login_attempts' => 'integer',
'require_password_update' => 'boolean',
'status' => UserStatuses::class,
'new_email' => 'string',
];
}

/**
* Get the user identifier
*/
Expand Down

0 comments on commit 20daf89

Please sign in to comment.