[FEAT] 完善個人資料頭像上傳功能與導覽列介面優化
This commit is contained in:
@@ -54,4 +54,16 @@ class User extends Authenticatable
|
||||
{
|
||||
return $this->hasMany(\App\Models\UserLoginLog::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user's avatar URL.
|
||||
*/
|
||||
public function getAvatarUrlAttribute(): string
|
||||
{
|
||||
if ($this->avatar) {
|
||||
return asset('storage/' . $this->avatar);
|
||||
}
|
||||
|
||||
return "https://ui-avatars.com/api/?name=" . urlencode($this->name) . "&background=0D8ABC&color=fff";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user