© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
7 replies
Abi

Binding TextColumn with a BelongsToMany relation

How can I bind a TextColumn with a belongsToMany relation. Not sure if I am making a mistake. For a customer_orders, I have an addresses with a BelongsToMany relationship because a customer can have a billing and a shipping address. The customers name is stored on the address table and I want to show that on the Order resource on filament. How do I go about doing this? should I use a ViewColumn?

I tried this, will it work

TextColumn::make('customer_name')->formatStateUsing(function ($state, $record) {
                $shippingAddress = $record->shippingAddress->first();
                return $shippingAddress->first_name . ' ' . $shippingAddress->last_name;
            }),
TextColumn::make('customer_name')->formatStateUsing(function ($state, $record) {
                $shippingAddress = $record->shippingAddress->first();
                return $shippingAddress->first_name . ' ' . $shippingAddress->last_name;
            }),
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

TextColumn BelongsToMany
FilamentFFilament / ❓┊help
2y ago
Using Select with a BelongsToMany relation
FilamentFFilament / ❓┊help
3y ago
BelongsToMany relation issue
FilamentFFilament / ❓┊help
3y ago
Dependant select with BelongsToMany relation
FilamentFFilament / ❓┊help
3y ago