How to change value of a request parameter in laravel
Example 1:
$requestData = $request->all();
$requestData['page'] = $page;
Example 2:
$request->merge(['page' => $page]);
Example 3:
If you want to add or overwrite nested data:
$data['data']['page'] = $page;
$request->merge($data);
If you do not inject Request $request
object, you can use the global request()
helper or \Request::
facade instead of $request