Repeater iteration
Forms\Components\Select::make('material_id')
->label(function (Closure $get, callable $set) {
return 'Item';
})->reactive()
->options(function (Closure $get, callable $set) {
$misc = FranchiseeMiscItemPrice::where('material_group_id', 42)->pluck('material_id');
$material = Material::whereIn('id', $misc)->pluck('name', 'id');
$selectedMaterialIds = collect($get('details.items'))->pluck('material_id')->filter();
$material = $material->except($selectedMaterialIds);
return $material;
})->columnSpan([
'lg' => 2,
])->searchable()->required(),
I am using this field inside the repeater. I am trying to achieve that I don't want to show the same data that I was selecting before in the repeater.Solution:Jump to solution
There is a post in here explaining how you can remove options that have already been selected recently ansewered
3 Replies
Solution
There is a post in here explaining how you can remove options that have already been selected recently ansewered
In repeater, we can repeat the same fields again. What I am doing means I don't want to select the same data in the repeated field because it is already selected, so I don't want to show the selected data in the repeated field.
What toeknee is saying is that this has been covered on here before. Run a search and I’m sure you’ll find the answer you need.