From 93c62a25f14a239bb632e9ef6cf388edc73e98ae Mon Sep 17 00:00:00 2001 From: Kailum Date: Thu, 9 Jan 2025 12:37:40 +0800 Subject: [PATCH] Fix values being wrapped in arrays causing multiple selected options to appear as a single option in the CMS --- src/Fieldtypes/HasSelectOptions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Fieldtypes/HasSelectOptions.php b/src/Fieldtypes/HasSelectOptions.php index 7e1289a3c4..9ce9df0b14 100644 --- a/src/Fieldtypes/HasSelectOptions.php +++ b/src/Fieldtypes/HasSelectOptions.php @@ -52,7 +52,7 @@ public function preProcessIndex($value) { $values = $this->preProcess($value); - $values = collect(is_array($values) ? $values : [$values]); + $values = collect($values)->toArray(); return $values->map(function ($value) { return $this->getLabel($value); @@ -67,7 +67,7 @@ public function preProcess($value) return []; } - $value = is_array($value) ? $value : [$value]; + $value = collect($value)->toArray(); $values = collect($value)->map(function ($value) { return $this->config('cast_booleans') ? $this->castFromBoolean($value) : $value;