© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
12 replies
1benjam1

Translatable plugin : make relationship field works

Hi ! I have a Mission model with a
institution() : BelongsTo
institution() : BelongsTo
relationship. On my Mission edit page (resource), I want to show the
institution.access_code
institution.access_code
field but Filament doesn't translate it and try to display the entire object. How can I make it works (display the field in the current locale) ?

Forms\Components\Group::make()
  ->relationship('institution')
  ->schema([
      Forms\Components\Section::make('Institution')
          ->schema([
              Forms\Components\TextInput::make('access_code')
])
Forms\Components\Group::make()
  ->relationship('institution')
  ->schema([
      Forms\Components\Section::make('Institution')
          ->schema([
              Forms\Components\TextInput::make('access_code')
])
image.png
Solution
->formatStateUsing(fn (string $state): string => $state['fr']['access_code'])

or

Forms\Components\TextInput::make('access_code.fr')
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

Spatie translatable Plugin - repeater field
FilamentFFilament / ❓┊help
3y ago
Spatie Translatable Plugin and relationship fieldset
FilamentFFilament / ❓┊help
2y ago
Required field validation with translatable plugin
FilamentFFilament / ❓┊help
3y ago
Translatable plugin doesn't support relationship selects
FilamentFFilament / ❓┊help
3y ago