elsonium
Disable select option if selected in another repeater item
Assume i have a repeater with Select options, how can i disable the option if its selected in another repeater's select?
Repeater::make('stocks')
->label('Merchant Stocks')
->schema([
Select::make('merchant_store_id')
->label('Merchant')
->reactive()
->options(function (Closure $get) {
return \App\Models\Merchant::all()->pluck('name', 'id');
})
->required(),
TextInput::make('stock_count')
->label('Stock Count')
->required(),
])
->disableItemMovement()
how do i ensure the above Select only a Merchant is selected once in repeater.
4 replies
Nested relationship managers
I have this relationship
Products has many ProductVariants
ProductVariants belongsToMany Merchants, where there will be a pivot column stock_count as each merchants maintains a different stock count for each product variants.
I have created a VariantRelationshipManager for ProductResource however im not sure how i can add a nested relationship manager(merchants relationship) into VariantRelationshipManager.
is there a way for nested relationship manager inside a relationship manager?
or i'm looking at it wrongly.
8 replies