F
Filament2mo ago
Vp

Multi-tenancy avatar

When implementing team avatar like this example , the avatar cannot display on tenant menu, but on profile edit page, it's showing This is how I put inside tenant profile
FileUpload::make('image')
->hiddenLabel()
->directory('teams')
->image()
->avatar()
->imageEditor()
->circleCropper()
->maxSize(1024)
FileUpload::make('image')
->hiddenLabel()
->directory('teams')
->image()
->avatar()
->imageEditor()
->circleCropper()
->maxSize(1024)
On Team model:
public function getFilamentAvatarUrl(): ?string
{
return $this->image;
}
public function getFilamentAvatarUrl(): ?string
{
return $this->image;
}
How can I make this image be visible on tenant menu? thanks in advance
No description
Solution:
I cannot figure out, so I submit a bug issue
Jump to solution
4 Replies
toeknee
toeknee2mo ago
The url returns 404 not found, have you linked the storage?!?!
Vp
VpOP2mo ago
Yes I linked storage, and it display correctly for edit "FileUpload" I put like this in Panel provider ->tenant(Team::class, 'slug') and the problem "I think" is: It append prepend team/team-slug on the image url by default
Solution
Vp
Vp4w ago
I cannot figure out, so I submit a bug issue
Vp
VpOP4w ago
Final solution is returning temporary url, or upload on public disk
public function getFilamentAvatarUrl(): ?string
{
return Storage::temporaryUrl($this->image, now()->addMinutes(5));
}
public function getFilamentAvatarUrl(): ?string
{
return Storage::temporaryUrl($this->image, now()->addMinutes(5));
}

Did you find this page helpful?