© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
42 replies
gigiloouu

relations table get data

i have 2 selections supplier and brand. in supplier table i have brand_id column i want when i choose supplier brand selection should shows me only brands which is in supplier brand_id have. i trying to do it using option and filter it but its not works, there is my code


   Select::make('supplier_id')
                    ->label('Supplier')
                    ->relationship('supplier', 'name')
                    ->searchable()
                    ->required()
                    ->preload()
                    
                    ]),
                Select::make('brand_id')
                    ->label('Brand')
                    ->relationship('brand', 'name')
                    ->searchable()
                    ->required()
                    ->preload()
                    ->options(function () {
                        $supplierBrandIds = Supplier::pluck('brand_id')->toArray();
                        return Brand::whereIn('id', $supplierBrandIds)->get()->pluck('name', 'id');
                    })

                    ->createOptionForm([
                        TextInput::make('name')
                            ->required()
                            ->label('New Brand'),
                    ]),
   Select::make('supplier_id')
                    ->label('Supplier')
                    ->relationship('supplier', 'name')
                    ->searchable()
                    ->required()
                    ->preload()
                    
                    ]),
                Select::make('brand_id')
                    ->label('Brand')
                    ->relationship('brand', 'name')
                    ->searchable()
                    ->required()
                    ->preload()
                    ->options(function () {
                        $supplierBrandIds = Supplier::pluck('brand_id')->toArray();
                        return Brand::whereIn('id', $supplierBrandIds)->get()->pluck('name', 'id');
                    })

                    ->createOptionForm([
                        TextInput::make('name')
                            ->required()
                            ->label('New Brand'),
                    ]),
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

Non-database Data Table
FilamentFFilament / ❓┊help
2y ago
Get current table data for widget
FilamentFFilament / ❓┊help
2y ago
Get table data from header action.
FilamentFFilament / ❓┊help
3y ago
how get data from filter table ?
FilamentFFilament / ❓┊help
3y ago