F
Filamentβ€’14mo ago
SirFat

Custom Actions within a Repeater Schema

Hi All, I'm creating a standalone form outside of a panel which loads a Livewire component of which you can see in one of the screenshots. That part works (mostly) OK. I'm trying to use a repeater as a mechanism to allow multiple items to be added to a cart/collection. Each items requires customisation that justifies a separate form/modal/slide-over, of which has actions of its own. The result will be fed back to the main Livewire component to display the outcome and invoke a 'onStateChange' which will update the total dollars spent. When I attempt to embed an 'Action' in the Repeater Schema, it explains that I am passing an 'Action' not a 'Component'. If I encase it in an Actions component, it loops and crashes.
Forms\Components\Section::make("Your SIM Selection")->schema([
Forms\Components\Repeater::make('SIMsToOrder')
->schema([
Forms\Components\Actions::make()->schema([ // This causes a loop
Action::make('configureSIM') // without the above, this complains I am not using a component
->modalContent(fn(Action $action): View => view(
'livewire.sim_configure',
['action' => $action],
))
]),
Forms\Components\Section::make("Your SIM Selection")->schema([
Forms\Components\Repeater::make('SIMsToOrder')
->schema([
Forms\Components\Actions::make()->schema([ // This causes a loop
Action::make('configureSIM') // without the above, this complains I am not using a component
->modalContent(fn(Action $action): View => view(
'livewire.sim_configure',
['action' => $action],
))
]),
I've included what the UI looks like now, and a drawing that shows the workflow I am trying to achieve. If anyone has the time and patience to review my 'art' and give me their point of view on approach, that would be fantastic. 🀞 πŸ™
No description
No description
Solution:
Disabled XDebug and this fixed it.
Jump to solution
2 Replies
SirFat
SirFatOPβ€’14mo ago
I've also corrected my incorrect use of Actions::make()
Forms\Components\Repeater::make('SIMsToOrder')
->schema([
Forms\Components\Actions::make([
Action::make('star')
->icon('heroicon-m-star')
->requiresConfirmation()
->action(function () {
}),
]),
Forms\Components\Repeater::make('SIMsToOrder')
->schema([
Forms\Components\Actions::make([
Action::make('star')
->icon('heroicon-m-star')
->requiresConfirmation()
->action(function () {
}),
]),
and still get this: Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '256' frames
Solution
SirFat
SirFatβ€’14mo ago
Disabled XDebug and this fixed it.
Want results from more Discord servers?
Add your server