File tree Expand file tree Collapse file tree
Template/Presentation/View/Engine Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ public static function setPagination(PaginationResult $pagination): void
2222 static ::$ pagination = $ pagination ;
2323 }
2424
25- public function scopePaged (
25+ public function scopePages (
2626 Builder $ query ,
2727 Request $ request ,
2828 ): Builder {
Original file line number Diff line number Diff line change @@ -183,12 +183,28 @@ private function registerFunctions(): void
183183
184184 $ this ->latte ->addFunction (
185185 'queryUrl ' ,
186- fn (array $ replace = [], array $ remove = [])
187- => $ this ->queryBuilder ->build (
188- $ this ->request ->query ->all (),
189- $ replace ,
190- $ remove
191- )
186+ function (array $ params = []) {
187+
188+ $ query = $ this ->request ->query ->all ();
189+
190+ foreach ($ query as $ key => $ value ) {
191+ if (is_array ($ value )) {
192+ $ query [$ key ] = end ($ value );
193+ }
194+ }
195+
196+ foreach ($ params as $ key => $ value ) {
197+
198+ if (is_int ($ key )) {
199+ unset($ query [$ value ]);
200+ continue ;
201+ }
202+
203+ $ query [$ key ] = $ value ;
204+ }
205+
206+ return $ query ? '? ' . http_build_query ($ query ) : '' ;
207+ }
192208 );
193209 }
194210
You can’t perform that action at this time.
0 commit comments