diff --git a/app/Http/Controllers/Backend/TaxonomyController.php b/app/Http/Controllers/Backend/TaxonomyController.php index 7a8d1b0..6ad38fe 100644 --- a/app/Http/Controllers/Backend/TaxonomyController.php +++ b/app/Http/Controllers/Backend/TaxonomyController.php @@ -118,25 +118,30 @@ public function update(Request $request, Taxonomy $taxonomy) } private function validateProperties(array $original, array $updated): bool { - // Ensure existing items are not modified - foreach ($original as $index => $originalItem) { - if (!isset($updated[$index])) { - return false; // Missing an existing property - } + // $originalMap = []; + // $updatedMap = []; + // foreach ($original as $item) $originalMap[$item->code] = $item; + // foreach ($updated as $item) $updatedMap[$item->code] = $item; - $updatedItem = $updated[$index]; - if ( - $originalItem->code !== $updatedItem->code || - $originalItem->name !== $updatedItem->name || - $originalItem->data_type !== $updatedItem->data_type - ) { - dd($originalItem->code,$updatedItem->code); - return false; // An existing property was altered - } - } + // // Ensure existing items are not modified + // foreach ($originalMap as $code => $originalItem) { + // if (!isset($updatedMap[$code])) { + // // TODO Let allow to delete if not used in any term + // return false; // Missing an existing property + // } + + // $updatedItem = $updatedMap[$code]; + // if ( + // $originalItem->data_type !== $updatedItem->data_type + // ) { + // // An existing property data type was altered + // // TODO Let allow to delete if not used in any term + // return false; + // } + // } - // Allow additional properties - return count($updated) >= count($original); + // Allow changes for now + return true; } /** * Confirm to delete the specified resource from storage. diff --git a/resources/views/backend/taxonomy/edit.blade.php b/resources/views/backend/taxonomy/edit.blade.php index e8a4db3..dc8900b 100644 --- a/resources/views/backend/taxonomy/edit.blade.php +++ b/resources/views/backend/taxonomy/edit.blade.php @@ -3,7 +3,7 @@ @section('title', __('Edit Taxonomy')) @section('content') -