How to "$set" Repeater itemLabel()
Hi... I manage to set repeater number base on the
Select::make('quantity') but how can I set itemLabel in afterStateUpdated? Let say if the selected
quantity is 3, the repeater will generate 3 Repeater TextInput with itemlabel value "Student" to all 3. How can I dynamically make it "Student 1", "Student 2", "Student 3"
Solution
I did this but the
foreach inside itemLabel will repeat entire array. Let say I select the quantity 2, then the loop log (Log::info($get('members'))) will look something like thisLastly, what I did is I add another
id array in afterStateUpdated and add another TextInput::make('id')->hidden() in the repeater schema then add ->itemLabel(fn (array $state): ?string => 'Student '.$state['id'] ?? null). Seem like confusing but here is the full code