© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
4 replies
codeartisan

FormatUsingState is null on a select relationship

                Forms\Components\Select::make('sponsor_id')
                    ->relationship('sponsor', 'first_name')
                    ->native(false)
                    ->formatStateUsing(function ($state, $record) {
                        //console.log($record);
                        dd($state);
                        return $record->first_name . ' ' . $record->second_name;
                    })
                    ->label("Sponsor Name")
                    ->searchable()
                    ->preload(),
                Forms\Components\Select::make('sponsor_id')
                    ->relationship('sponsor', 'first_name')
                    ->native(false)
                    ->formatStateUsing(function ($state, $record) {
                        //console.log($record);
                        dd($state);
                        return $record->first_name . ' ' . $record->second_name;
                    })
                    ->label("Sponsor Name")
                    ->searchable()
                    ->preload(),
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

Select of relationship gives "call on null"
FilamentFFilament / ❓┊help
3y ago
Select with Relationship always Null
FilamentFFilament / ❓┊help
2y ago
Select with relationship inside repeater return null.
FilamentFFilament / ❓┊help
13mo ago
default select on relationship
FilamentFFilament / ❓┊help
3y ago