Laravel - add to GET parameter manually

xelber :

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)

Ruben Danielyan :

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());
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=15518&siteId=1