F
Filament2mo ago
Daniel

How load related record on repeatable entry (sorry for bad english)

Hi ! I can create a resource for suppliers that have a relationship with products. In my repeatable entry I have a button for each product, which opens a modal and in this modal I need to say in the first TextInput what the category of the selected product is, but when I pull the record in the function, the supplier comes and not the product from the repeatable entry. my code:
RepeatableEntry::make('products')
->columns(2)
->schema([
TextEntry::make('category.name')
->label(__('Category')),
TextEntry::make('warehouseBrand.name')
->label(__('Brand')),
Actions::make([
Action::make('Buy')
->label(__('Buy'))
->color('success')
->form([
Forms\Components\TextInput::make('product_category')
->default(fn ($record) => $record->category?->name)
->disabled(),
Forms\Components\TextInput::make('quantity')
->label(__('Quantity'))
->required()
->numeric()
->minValue(1)
])
])->columnSpan(2)
RepeatableEntry::make('products')
->columns(2)
->schema([
TextEntry::make('category.name')
->label(__('Category')),
TextEntry::make('warehouseBrand.name')
->label(__('Brand')),
Actions::make([
Action::make('Buy')
->label(__('Buy'))
->color('success')
->form([
Forms\Components\TextInput::make('product_category')
->default(fn ($record) => $record->category?->name)
->disabled(),
Forms\Components\TextInput::make('quantity')
->label(__('Quantity'))
->required()
->numeric()
->minValue(1)
])
])->columnSpan(2)
No description
No description
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?