© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago
Gandalf

Get another field from selected relationship record

Is there a way (apart from another db fetch) to get a different field for the relationship record from a select dropdown?

I've form fields like this:
Forms\Components\Select::make('category_id')
  ->relationship('category', 'name')
  ->required()
  ->live()
  ->afterStateUpdated(fn (Set $set, ?string $state) => $set('popular_category', $state < 10)),
Forms\Components\Toggle::make('popular_category')
  ->inline(false),
Forms\Compnents\TextInput::make('owner_name')
  ->visible(function (Get $get) {
    //TODO: return true if category.owner_name is null
    return true;
  }),
Forms\Components\Select::make('category_id')
  ->relationship('category', 'name')
  ->required()
  ->live()
  ->afterStateUpdated(fn (Set $set, ?string $state) => $set('popular_category', $state < 10)),
Forms\Components\Toggle::make('popular_category')
  ->inline(false),
Forms\Compnents\TextInput::make('owner_name')
  ->visible(function (Get $get) {
    //TODO: return true if category.owner_name is null
    return true;
  }),

Now, I wish to conditionally show owner_name field only if the selected category has its owner_name set as blank. Is there a way to do it without fetching the record from database?
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

Get relationship Select record data from $get
FilamentFFilament / ❓┊help
3y ago
Get value from another Grid relationship
FilamentFFilament / ❓┊help
2y ago
TextColumn get relationship record
FilamentFFilament / ❓┊help
2y ago
relationship from another database
FilamentFFilament / ❓┊help
3y ago