© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
5 replies
Vincent Klaiber

Conditional form relationships

Is there a way to fetch related models, in the same form, based on another field value?

Select::make('user_id')
    ->label('User')
    ->options(User::all()->pluck('name', 'id'))
    ->required(),
Select::make('post_id')
    ->label('Post')
    ->options(Post::where('author_id', 'SELECTED-USER-ID?')->get()->pluck('name', 'id'))
    ->required(),
Select::make('user_id')
    ->label('User')
    ->options(User::all()->pluck('name', 'id'))
    ->required(),
Select::make('post_id')
    ->label('Post')
    ->options(Post::where('author_id', 'SELECTED-USER-ID?')->get()->pluck('name', 'id'))
    ->required(),

1. Is there a way to list posts by the selected user?
SELECTED-USER-ID
SELECTED-USER-ID

2. Is there a way to disable the post select field until a user is selected?
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

Form relationships
FilamentFFilament / ❓┊help
2y ago
Testing form with relationships
FilamentFFilament / ❓┊help
2y ago
Conditional visibility of form fields
FilamentFFilament / ❓┊help
15mo ago
Nesting form fields depending on relationships
FilamentFFilament / ❓┊help
2y ago