How customize Repeater's item using Livewire component?
Livewire 3x.
I have a Livewire component
OpportunityQuote
that has a Repeater in its structure, like this:
4 Replies
For each item in my Repeater, I will have another custom Livewire component.
How do I make each line of my Repeater with custom component to have the
current
item?
If we look at the itemLabel
method, it has by default a $state
that represents the current line, so you can customize the title.
But, Within the schema
method, the variable $state
does not just represent a line, but rather the state of the Repeater as a whole, being multi-dimensional array.
But, how do I do this?You have access to both $arguments as array and $component as Repeater, using the $component you can get the current item state as a casted array, here is an example from the docs
Applying it to your case
In my case, I dont have extra actions ...
I was needing to get this
$arguments['item']
inside schema
method, but, it is not possibleI think in the repeater you could use a ViewField
Render the LW component in the view and pass the component state that you need