{{ $dps->appends([$request->toarray()])->links() }}
You've added two array hierarchies here... "toArray" already returns an array so you don't need the brackets around it.
{{ $dps->appends($request->all())->links() }}
Does this work?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
good day,
I'm setting up a complex query. Depending on different variables. Coming from a form.
Loading of the page works fine. Also the setting of pagination -> links().
$request =
Request {#43 ▼
#json: null
#convertedFiles: []
#userResolver: Closure {#446 ▶}
#routeResolver: Closure {#440 ▶}
+attributes: ParameterBag {#45 ▶}
+request: ParameterBag {#44 ▼
#parameters: array:17 [▼
"_token" => "Ds5L96HxUVDNVRDbd413P5MRDfsMQnpKgethC7lK"
"formatted_address" => ""
"dp_street" => ""
"dp_housenum" => ""
"dp_zipcode" => ""
"dp_place_name" => ""
"dp_department_name" => "Zuid-Holland"
"dp_country_name" => ""
"dp_latitude" => "52.0207975"
"dp_longitude" => "4.4937836"
"type" => "dps"
"dp_distance" => ""
"dp_department_id" => "31"
"dp_place_name_id" => ""
"dp_region_name" => ""
"dp_region_id" => ""
"dp_place_id" => ""
]
}
But when you click next the query breaks. It seems that the query is not executed because the variable out of the request are missing.
$request =
Request {#43 ▼
#json: null
#convertedFiles: []
#userResolver: Closure {#445 ▶}
#routeResolver: Closure {#439 ▶}
+attributes: ParameterBag {#45 ▶}
+request: ParameterBag {#51 ▼
#parameters: array:1 [▼
"page" => "2"
]
}
It seems that links() needs the same #request variables. How can i pass these? I tried " appending" but did not work out.
{{ $dps->appends([$request->toarray()])->links() }}
It is an search form. So the variables differ every time.
Is there a way to solve this?
thanks in advance.
br
maarten
{{ $dps->appends([$request->toarray()])->links() }}
You've added two array hierarchies here... "toArray" already returns an array so you don't need the brackets around it.
{{ $dps->appends($request->all())->links() }}
Does this work?
Please or to participate in this conversation.