Merge pull request #4541 from pixelfed/staging

Update user model
This commit is contained in:
daniel 2023-07-14 04:33:41 -06:00 committed by GitHub
commit 1a30e488f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,9 +19,10 @@ class User extends Authenticatable
* @var array
*/
protected $casts = [
'deleted_at' => 'datetime',
'email_verified_at' => 'datetime',
'2fa_setup_at' => 'datetime'
'deleted_at' => 'datetime',
'email_verified_at' => 'datetime',
'2fa_setup_at' => 'datetime',
'last_active_at' => 'datetime',
];
/**
@ -30,7 +31,13 @@ class User extends Authenticatable
* @var array
*/
protected $fillable = [
'name', 'username', 'email', 'password', 'app_register_ip'
'name',
'username',
'email',
'password',
'app_register_ip',
'email_verified_at',
'last_active_at'
];
/**
@ -39,8 +46,8 @@ class User extends Authenticatable
* @var array
*/
protected $hidden = [
'email', 'password', 'is_admin', 'remember_token',
'email_verified_at', '2fa_enabled', '2fa_secret',
'email', 'password', 'is_admin', 'remember_token',
'email_verified_at', '2fa_enabled', '2fa_secret',
'2fa_backup_codes', '2fa_setup_at', 'deleted_at',
'updated_at'
];
@ -100,11 +107,11 @@ class User extends Authenticatable
public function avatarUrl()
{
if(!$this->profile_id || $this->status) {
return config('app.url') . '/storage/avatars/default.jpg';
}
if(!$this->profile_id || $this->status) {
return config('app.url') . '/storage/avatars/default.jpg';
}
return AvatarService::get($this->profile_id);
return AvatarService::get($this->profile_id);
}
}