// Use internal Filament events to add the new item and move it to the start of the list
public function addFormItem() {
$this->mountFormComponentAction('data.criteria', 'add');
$ids = array_keys($this->data['criteria']);
$newItemId = array_pop($ids);
$ids = [$newItemId, ...$ids];
$this->mountFormComponentAction('data.criteria', 'reorder', [
'items' => $ids
]);
}
// Use internal Filament events to add the new item and move it to the start of the list
public function addFormItem() {
$this->mountFormComponentAction('data.criteria', 'add');
$ids = array_keys($this->data['criteria']);
$newItemId = array_pop($ids);
$ids = [$newItemId, ...$ids];
$this->mountFormComponentAction('data.criteria', 'reorder', [
'items' => $ids
]);
}