[FIX] 修復個人檔案與導覽列頭像不顯示問題,並實作即時更新邏輯
All checks were successful
star-cloud-deploy-demo / deploy-demo (push) Successful in 47s
All checks were successful
star-cloud-deploy-demo / deploy-demo (push) Successful in 47s
This commit is contained in:
@@ -82,4 +82,17 @@ class User extends Authenticatable
|
||||
{
|
||||
return !is_null($this->company_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URL for the user's avatar.
|
||||
*/
|
||||
public function getAvatarUrlAttribute(): string
|
||||
{
|
||||
if ($this->avatar) {
|
||||
return \Illuminate\Support\Facades\Storage::disk('public')->url($this->avatar);
|
||||
}
|
||||
|
||||
// Return a default UI Avatar if no avatar is set
|
||||
return "https://ui-avatars.com/api/?name=" . urlencode($this->name) . "&color=7F9CF5&background=EBF4FF";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user