F
Filament2mo ago
Mohmd

Delete Item in Repeater

Hi All, When I tried to implement deletable in my Repeater, I wanted to make a condition if this item's addable_id is 1, return false; other wise return true. I did this, but it is not working for me ->deletable(fn (array $state): ?string => $addable_id['name'] == 1 ?? false), Anu help please
5 Replies
toeknee
toeknee2mo ago
->deletable(fn (Get $get) => $get('id') == 1 ?? false)
->deletable(fn (Get $get) => $get('id') == 1 ?? false)
? something liek that
Mohmd
MohmdOP2mo ago
let me try
Dennis Koch
Dennis Koch2mo ago
I did this, but it is not working for me
Did you try some debugging? Any errors? You use $addable_id which looks undefined What data is passed in as $state?
Mohmd
MohmdOP2mo ago
I passed $state['addable_id] but it undefined when I use dd($state) it return the full object with education as list because I useed the repater with relationship and bind profile model $state['addable_id] is in education which is in the relationship
Dennis Koch
Dennis Koch2mo ago
Can you try:
function (array $arguments, Repeater $component): void {
$itemData = $component->getItemState($arguments['item']);
}
function (array $arguments, Repeater $component): void {
$itemData = $component->getItemState($arguments['item']);
}

Did you find this page helpful?