File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -569,13 +569,20 @@ public function get(array|string $selects = ['*']): Collection
569569 /**
570570 * Select the given attributes to retrieve.
571571 */
572- public function select (array |string $ selects ): static
572+ public function select (array |string $ selects = [ ' * ' ] ): static
573573 {
574+ $ selects = is_array ($ selects ) ? $ selects : func_get_args ();
575+
576+ // Default to all attributes if empty.
577+ if (empty ($ selects )) {
578+ $ selects = ['* ' ];
579+ }
580+
574581 // If selects are being overridden, then we need to ensure
575582 // the GUID key is always selected so that it may be
576583 // returned in the results for model hydration.
577584 $ selects = array_values (array_unique (
578- array_merge ([$ this ->model ->getGuidKey ()], ( array ) $ selects )
585+ array_merge ([$ this ->model ->getGuidKey ()], $ selects )
579586 ));
580587
581588 $ this ->query ->select ($ selects );
@@ -588,6 +595,8 @@ public function select(array|string $selects): static
588595 */
589596 public function addSelect (array |string $ select ): static
590597 {
598+ $ select = is_array ($ select ) ? $ select : func_get_args ();
599+
591600 $ this ->query ->addSelect ($ select );
592601
593602 return $ this ;
You can’t perform that action at this time.
0 commit comments