$get() scope for Repeater actions

Hello, I'm trying to customize a Repeater's DeleteAction through the deleteAction() method, and I'm using a closure to configure the $action:
//

Repeater::make('relationshipName')
->relationship()
//other configuration
->deleteAction(fn(Action $action) => $action->requiresConfirmation(fn(Get $get) => debug($get('*'))));

//
//

Repeater::make('relationshipName')
->relationship()
//other configuration
->deleteAction(fn(Action $action) => $action->requiresConfirmation(fn(Get $get) => debug($get('*'))));

//
the debug output suggests the $get is scoped to the parent, not the repeater item (which I understand only happens inside the repeater schema itself):
array:5 [▼
0 => null
1 => 0
2 => array:13 [▶]
3 => array:1 [▶]
4 => array:3 [▼ //repeater items
"6239daa3-527e-453e-b75f-60c20019f870" => array:6 [▼
//repeater item fields
],
//other repeater items
]
]
array:5 [▼
0 => null
1 => 0
2 => array:13 [▶]
3 => array:1 [▶]
4 => array:3 [▼ //repeater items
"6239daa3-527e-453e-b75f-60c20019f870" => array:6 [▼
//repeater item fields
],
//other repeater items
]
]
Is there a workaround, if not an intended method, to access the repeater item fields inside the deleteAction() closure? I would like the deletion to only ask for confirmation if a specific required field within the repeater has been filled. I have also tried injecting the $get in the first closure and invoking it in the second closure without parameters
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?