ejoi8
How to "$set" Repeater itemLabel()
The idea is I want add numbering to each repeater. The list could be large so the numbering will help user to identify how many list are there
I believe there could be better workaround on this and please share here if you do so.
14 replies
How to "$set" Repeater itemLabel()
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 this
Lastly, 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 code14 replies
How to "$set" Repeater itemLabel()
If use callback in
ItemLabel
, the return value still will be same to all the generated Repeater. I just want to append numbering ,maybe by using some sort of array index value but I have no idea where to start14 replies
Basic question regarding relationships in a resource
Or maybe this also would help you
https://filamentphp.com/docs/3.x/panels/resources/creating-records#customizing-data-before-saving
https://filamentphp.com/docs/3.x/panels/resources/editing-records#customizing-data-before-filling-the-form
6 replies