forked from mirror/pixelfed
Update user model
This commit is contained in:
parent
c07233a1c1
commit
4b611be2d9
1 changed files with 17 additions and 10 deletions
27
app/User.php
27
app/User.php
|
@ -19,9 +19,10 @@ class User extends Authenticatable
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'deleted_at' => 'datetime',
|
'deleted_at' => 'datetime',
|
||||||
'email_verified_at' => 'datetime',
|
'email_verified_at' => 'datetime',
|
||||||
'2fa_setup_at' => 'datetime'
|
'2fa_setup_at' => 'datetime',
|
||||||
|
'last_active_at' => 'datetime',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +31,13 @@ class User extends Authenticatable
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $fillable = [
|
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
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
'email', 'password', 'is_admin', 'remember_token',
|
'email', 'password', 'is_admin', 'remember_token',
|
||||||
'email_verified_at', '2fa_enabled', '2fa_secret',
|
'email_verified_at', '2fa_enabled', '2fa_secret',
|
||||||
'2fa_backup_codes', '2fa_setup_at', 'deleted_at',
|
'2fa_backup_codes', '2fa_setup_at', 'deleted_at',
|
||||||
'updated_at'
|
'updated_at'
|
||||||
];
|
];
|
||||||
|
@ -100,11 +107,11 @@ class User extends Authenticatable
|
||||||
|
|
||||||
public function avatarUrl()
|
public function avatarUrl()
|
||||||
{
|
{
|
||||||
if(!$this->profile_id || $this->status) {
|
if(!$this->profile_id || $this->status) {
|
||||||
return config('app.url') . '/storage/avatars/default.jpg';
|
return config('app.url') . '/storage/avatars/default.jpg';
|
||||||
}
|
}
|
||||||
|
|
||||||
return AvatarService::get($this->profile_id);
|
return AvatarService::get($this->profile_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue