#How does one conditionally hide individual items from a repeater?
16 messages · Page 1 of 1 (latest)
I do suppose I can do a custom query for this to limit the items that are shown, but even so, how would that be approached?
The relationships work quite differently as far as I can tell in repeaters.
I am confused what you mean skip an item in a repeater? Can you provide code of your setup and what you are tyring to hide?
I have a resource, simple resource bound to a model.
The model has a field for prices, where it leads to an array of prices.
I will try and provide a sample one sec
repeater like this
Repeater::make("prices")
->schema([
Select::make("currency_id")
->relationship("currency", "code")
->searchable()
->required()
->preload()
->distinct(),
TextInput::make("price_cents")
->required()
->label("Amount")
->numeric(),
])
->relationship("prices")
->columns()
->addActionLabel("Add another currency")
->columnSpanFull()
]),
this is on a Product::class resource, so it will have a relation prices(), as indicated by the relationship()
my use case is that my default currency (in this case USD) should not be listed here, even tho in the db, it is in prices()
it's just that there is another separate field to set specifially USD
do I modify the query on the relationship maybe?
forgive my awful trackpad drawing
ok honestly I just did it like this
I don't know why this was so hard before I guess I was cooked after waking up at 6am