File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ public function last(): ?Suggestion
130130 return $ this ->all ()?->last();
131131 }
132132
133- public function all (): Collection
133+ public function all (bool $ serialize = false ): Collection
134134 {
135135 $ url_parameter_string = http_build_query ($ this ->url_parameters );
136136 $ base_url = $ this ->getBaseUrl ();
@@ -141,7 +141,13 @@ public function all(): Collection
141141 $ return = [];
142142
143143 foreach ($ data ?->suggestions ?? [] as $ suggestion ) {
144- $ return [] = new Suggestion ($ suggestion );
144+ $ suggest = new Suggestion ($ suggestion );
145+
146+ if ($ serialize ) {
147+ $ suggest = $ suggest ->serialize ();
148+ }
149+
150+ $ return [] = $ suggest ;
145151 }
146152
147153 return collect ($ return );
Original file line number Diff line number Diff line change @@ -18,4 +18,9 @@ public function __call($method, $args = [])
1818 {
1919 return $ this ?->$ method ?? null ;
2020 }
21+
22+ public function serialize ()
23+ {
24+ return serialize ($ this );
25+ }
2126}
You can’t perform that action at this time.
0 commit comments