© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
1 reply
Rolland

Organizing a collection

Tables\Columns\TextColumn::make('userLocations')
                    ->label('Locations')
                    ->searchable()
                    ->sortable()
                    ->badge()
                    ->formatStateUsing(
                        fn(Model $record) => $record->userLocations->map(
                            fn($location) => $location->country->name . ' ' . $location->state->name
                        )->implode(PHP_EOL)
                    )
Tables\Columns\TextColumn::make('userLocations')
                    ->label('Locations')
                    ->searchable()
                    ->sortable()
                    ->badge()
                    ->formatStateUsing(
                        fn(Model $record) => $record->userLocations->map(
                            fn($location) => $location->country->name . ' ' . $location->state->name
                        )->implode(PHP_EOL)
                    )


so I have this code. and i wanted the output to be like:

Botswana Chobe
Andorra Encamp
Botswana Chobe
Andorra Encamp


but the output i get is

Botswana Chobe Andorra Encamp
Botswana Chobe Andorra Encamp
Botswana Chobe Andorra Encamp
Botswana Chobe Andorra Encamp
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

TableBuilder from a Collection
FilamentFFilament / ❓┊help
3y ago
Use a collection in a table
FilamentFFilament / ❓┊help
3y ago
Use a collection instead of a relation in the relationmanager
FilamentFFilament / ❓┊help
3y ago
Field 'collection_name' doesn't have a default value
FilamentFFilament / ❓┊help
2y ago