2

Is there a way of adding to the GET parameter in Laravel, so that I can use

$request->input('param')

I've tried setting it in $_GET and did not pick up. Basically I want to set something in to the HTTP Request's GET parameter set, so that I can retrieve it as if it was pass in as a GET params. (Which is sometimes sent)

xelber
  • 4,197
  • 3
  • 25
  • 33

1 Answers1

1

You can add params to your Request $request object like this

public function missingSomeParam(Request $request)
{
    // let's think you don't have "name" param sent in $request
    // set it this way
    $name = "Dummy Name";
    $request->request->add(['name' => $name]);
    dd($request->all());
}
Ruben Danielyan
  • 728
  • 4
  • 19