© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
13 replies
NDO

ImageColumn default url for stacked columns

Hey 👋 I am trying to create a stacked image column for related model (users). Because user model image is not required I want to set default image url with method that returns full url of user avatar if his img_path field is empty.

I tried with code below but it is not working because the method defaultImageUrl should return the string and not the array value. Does anyone know how I can set default image url for the stacked ImageColumn?

Tables\Columns\ImageColumn::make('users.img_path')
->label('Peoples')
->circular()
->stacked()
->limit()
->limitedRemainingText()
->defaultImageUrl(function ($record) {
$images=[];
foreach($record->users as $user) {
$images[] = $user->getImageUrl();
}
return $images;
}),
Solution
I think this would be better as an attribute on the model that can return the default image if it doesn’t exist. Then reference that attribute for the column instead of img_path. Then you don’t need to worry about the defaultImageUrl.
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

stacked Imagecolumn with tooltip/title?
FilamentFFilament / ❓┊help
9mo ago
Add column label for stacked columns.
FilamentFFilament / ❓┊help
3y ago
Actions in table stacked into columns
FilamentFFilament / ❓┊help
3y ago
ImageColumn::class with url encode
FilamentFFilament / ❓┊help
3y ago