© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
3 replies
Rahman Ramsi

How to access parent record inside repeater field?

I have a Repeater with relationship inside Form, i want to validate the item inside repeater using unique validation, what i need is the id from parent, but i cant get that record. Here's the fields :
[
  TextInput::make('name')
      ->required(),
  Repeater::make('details')
      ->relationship()
      ->schema([
          Grid::make()
              ->schema([
                  Select::make('category_id')
                      ->relationship('category', 'name')
                      ->unique(ignoreRecord: true, modifyRuleUsing: function(Unique $rule, Get $get, $record){
                          // $record result is the record from current item, not parent item 
                          // I need a $parent to validate that this item is unique by parent_id, type_id, and category_id columns
                         return $rule->where('type_id', $get('type_id'))->where('parent_id', $parent->getKey());
                      })
                      ->required(),
                  Select::make('type_id')
                      ->relationship('type', 'name')
                      ->required(),
                  TextInput::make('fee')
                      ->numeric()
                      ->required(),
              ]),
      ])
]
[
  TextInput::make('name')
      ->required(),
  Repeater::make('details')
      ->relationship()
      ->schema([
          Grid::make()
              ->schema([
                  Select::make('category_id')
                      ->relationship('category', 'name')
                      ->unique(ignoreRecord: true, modifyRuleUsing: function(Unique $rule, Get $get, $record){
                          // $record result is the record from current item, not parent item 
                          // I need a $parent to validate that this item is unique by parent_id, type_id, and category_id columns
                         return $rule->where('type_id', $get('type_id'))->where('parent_id', $parent->getKey());
                      })
                      ->required(),
                  Select::make('type_id')
                      ->relationship('type', 'name')
                      ->required(),
                  TextInput::make('fee')
                      ->numeric()
                      ->required(),
              ]),
      ])
]
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

How to access $record in RelationManager inside Repeater Select
FilamentFFilament / ❓┊help
3y ago
Resource repeater save record field inside relation manager
FilamentFFilament / ❓┊help
3y ago
Repeater access current $record
FilamentFFilament / ❓┊help
3y ago
Access BulkAction $record inside a form field closure
FilamentFFilament / ❓┊help
3y ago