File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -301,7 +301,13 @@ public function multiple(Closure|bool $multiple = true): static
301301
302302 public function prepend (Closure |array |null $ prepend = null ): static
303303 {
304- $ this ->prepend = $ prepend ;
304+ $ this ->prepend = $ this ->evaluate ($ prepend );
305+
306+ if (is_array ($ this ->prepend ) && isset ($ this ->prepend ['name ' ], $ this ->prepend ['value ' ])) {
307+ $ this ->prepend ['value ' ] = (string ) $ this ->prepend ['value ' ];
308+ } else {
309+ throw new \InvalidArgumentException ('The provided prepend value must be an array with "name" and "value" keys. ' );
310+ }
305311
306312 return $ this ;
307313 }
@@ -441,9 +447,11 @@ public function getIndependent(): bool
441447 return $ this ->evaluate ($ this ->independent );
442448 }
443449
444- public function getCustomKey ($ record )
450+ public function getCustomKey ($ record ): string
445451 {
446- return is_null ($ this ->customKey ) ? $ record ->getKey () : $ record ->{$ this ->customKey };
452+ $ key = is_null ($ this ->customKey ) ? $ record ->getKey () : $ record ->{$ this ->customKey };
453+
454+ return (string ) $ key ;
447455 }
448456
449457 public function getWithCount (): bool
@@ -614,4 +622,15 @@ public function createOptionModalHeading(string|Closure|null $heading): static
614622
615623 return $ this ;
616624 }
625+
626+ public function getState (): mixed
627+ {
628+ $ state = parent ::getState ();
629+
630+ if (is_array ($ state )) {
631+ return array_map (fn ($ value ) => (string ) $ value , $ state );
632+ }
633+
634+ return (string ) $ state ;
635+ }
617636}
You can’t perform that action at this time.
0 commit comments