F
Filament15mo ago
Zetto

ImageColumn custom state (array/collection)

I want to customize ImageColumn state, i managed to customize for one image, however i don't know how to do it for multiple images chained with stacked() function. I tried returning collection for the state and it does not work.
1 Reply
Zetto
ZettoOP15mo ago
Current code
Tables\Columns\ImageColumn::make('supervisor')
->state(function (FinalProject $record) {
$list = collect();
foreach ($record->lecturers as $lecturer)
{
if ($lecturer->pivot->role == 'supervisor') {
$list->push($lecturer->image);
}
}
return $list;
})
->circular()
->stacked(),
Tables\Columns\ImageColumn::make('supervisor')
->state(function (FinalProject $record) {
$list = collect();
foreach ($record->lecturers as $lecturer)
{
if ($lecturer->pivot->role == 'supervisor') {
$list->push($lecturer->image);
}
}
return $list;
})
->circular()
->stacked(),
Solved, use Array as return type instead of Collection
Want results from more Discord servers?
Add your server