© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
10 replies
Gush

get select record on relation manager attach form

Hey, i need help understanding how do i get the equipment id i selected on form in order to make a custom rule checking for existing records with the same equipment_id and serial_number

here is the code

->rule(static function (Forms\Get $get, Forms\Components\Component $component): Closure {
                                return static function (string $attribute, $value, Closure $fail) use ($get, $component) {

                                    $equipmentID = ;

                                    $existingRecord = DB::table('construction_has_equipment')
                                        ->where('serial_number', $value)
                                        ->where('equipment_id', $equipmentID)
                                        ->exists();

                                    if ($existingRecord) {
                                        $fail(__('construction-equipment.construction_equipment_resource.error'));
                                    }
                                };
                            }),
->rule(static function (Forms\Get $get, Forms\Components\Component $component): Closure {
                                return static function (string $attribute, $value, Closure $fail) use ($get, $component) {

                                    $equipmentID = ;

                                    $existingRecord = DB::table('construction_has_equipment')
                                        ->where('serial_number', $value)
                                        ->where('equipment_id', $equipmentID)
                                        ->exists();

                                    if ($existingRecord) {
                                        $fail(__('construction-equipment.construction_equipment_resource.error'));
                                    }
                                };
                            }),
Solution
how about
$get($action->getRecordSelect()->getName())
$get($action->getRecordSelect()->getName())
?
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

format options on relationship manager select in attach form
FilamentFFilament / ❓┊help
3y ago
Attach relation manager
FilamentFFilament / ❓┊help
3y ago
Attach Relation Manager
FilamentFFilament / ❓┊help
3y ago
Mutate form data before creating record on relation manager
FilamentFFilament / ❓┊help
2y ago