© 2026 Hedgehog Software, LLC

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

Read data into repeater based on selected filed

there is a products table with mark_id if i chose the mark_id i want to fill all the products with the selected mark_id in my repeater and then save the repeater data in my packedProducts model using relationship please help me this is my code and screenshot.
 Forms\Components\Select::make('mark_id')
                            ->label('Mark')
                            ->reactive()
                            ->options(function () {
                                return Mark::whereHas('warehouse', function ($query) {
                                    $query->where('status', 'delivered')
                                         ->whereHas('products', function ($query) {
                                             $query->where('remaining_qty', '>', 0);
                                         });
                                })->pluck('name', 'id');
                            })->searchable()->reactive(),

          Forms\Components\Repeater::make('packed_products')
                    ->relationship()
                    ->reactive()
                    ->schema(function (\Filament\Forms\Get $get) {

                        if (!$get('../mark_id')) {
                            return [Forms\Components\Placeholder::make('Select Mark First')];
                        }

                        [
                            Forms\Components\TextInput::make('product_name')
                                ->required()->numeric()->reactive()->rules('numeric|gt:0')
                            Forms\Components\TextInput::make('quantity')
                                ->required()->numeric()->reactive()->rules('numeric|gt:0')
                            Forms\Components\Placeholder::make('remaining_qty')->reactive()
                        ];

                    });
 Forms\Components\Select::make('mark_id')
                            ->label('Mark')
                            ->reactive()
                            ->options(function () {
                                return Mark::whereHas('warehouse', function ($query) {
                                    $query->where('status', 'delivered')
                                         ->whereHas('products', function ($query) {
                                             $query->where('remaining_qty', '>', 0);
                                         });
                                })->pluck('name', 'id');
                            })->searchable()->reactive(),

          Forms\Components\Repeater::make('packed_products')
                    ->relationship()
                    ->reactive()
                    ->schema(function (\Filament\Forms\Get $get) {

                        if (!$get('../mark_id')) {
                            return [Forms\Components\Placeholder::make('Select Mark First')];
                        }

                        [
                            Forms\Components\TextInput::make('product_name')
                                ->required()->numeric()->reactive()->rules('numeric|gt:0')
                            Forms\Components\TextInput::make('quantity')
                                ->required()->numeric()->reactive()->rules('numeric|gt:0')
                            Forms\Components\Placeholder::make('remaining_qty')->reactive()
                        ];

                    });
image.png
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Struggling to Populate Repeater with Data Based on Selected Item
FilamentFFilament / ❓┊help
3y ago
Questions based on repeater
FilamentFFilament / ❓┊help
2y ago
Display data based on the option selected in select
FilamentFFilament / ❓┊help
11mo ago
Emit selected item on repeater items
FilamentFFilament / ❓┊help
3y ago