From ab99409146f961718d6f010238699f482b4e1c9c Mon Sep 17 00:00:00 2001 From: CodeWithDennis <23448484+CodeWithDennis@users.noreply.github.com> Date: Sat, 5 Apr 2025 14:19:26 +0200 Subject: [PATCH] Revert "Fix #131" --- src/SelectTree.php | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/src/SelectTree.php b/src/SelectTree.php index 8a9b7b7..e809057 100644 --- a/src/SelectTree.php +++ b/src/SelectTree.php @@ -301,13 +301,7 @@ public function multiple(Closure|bool $multiple = true): static public function prepend(Closure|array|null $prepend = null): static { - $this->prepend = $this->evaluate($prepend); - - if (is_array($this->prepend) && isset($this->prepend['name'], $this->prepend['value'])) { - $this->prepend['value'] = (string) $this->prepend['value']; - } else { - throw new \InvalidArgumentException('The provided prepend value must be an array with "name" and "value" keys.'); - } + $this->prepend = $prepend; return $this; } @@ -447,11 +441,9 @@ public function getIndependent(): bool return $this->evaluate($this->independent); } - public function getCustomKey($record): string + public function getCustomKey($record) { - $key = is_null($this->customKey) ? $record->getKey() : $record->{$this->customKey}; - - return (string) $key; + return is_null($this->customKey) ? $record->getKey() : $record->{$this->customKey}; } public function getWithCount(): bool @@ -622,15 +614,4 @@ public function createOptionModalHeading(string|Closure|null $heading): static return $this; } - - public function getState(): mixed - { - $state = parent::getState(); - - if (is_array($state)) { - return array_map(fn ($value) => (string) $value, $state); - } - - return (string) $state; - } }