From e65ad14d7c4475287dbe19b9444e1a2b27d5ac50 Mon Sep 17 00:00:00 2001 From: Arthur Perton Date: Thu, 24 Jun 2021 16:08:33 +0200 Subject: [PATCH] Delete trees when setting a collection to not orderable --- src/Http/Controllers/CP/Collections/CollectionsController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Http/Controllers/CP/Collections/CollectionsController.php b/src/Http/Controllers/CP/Collections/CollectionsController.php index c77ed98e88..90f8313685 100644 --- a/src/Http/Controllers/CP/Collections/CollectionsController.php +++ b/src/Http/Controllers/CP/Collections/CollectionsController.php @@ -223,6 +223,9 @@ public function update(Request $request, $collection) } if (! $values['structured']) { + if ($structure = $collection->structure()) { + $structure->trees()->each->delete(); + } $collection->structure(null); } else { $collection->structure($this->makeStructure($collection, $values['max_depth'], $values['expects_root'], $values['sites'] ?? null));