Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel: Add data to the Input::all()

Tags:

php

laravel-4

I am grabbing the values from the parameters in the URL domain.com?para=value in the controller using Input:all()

Is there a way to add more values to the Input:all() in the controller?

I have tried $_POST['para'] = "value and $_GET['para'] = "value" but no luck.

I've gone through the docs but cannot find anything.

Thanks

More Info

Here is what is returned

{
  "param_1" => "value",
  "param_2" => "value",
  "param_3" => "value",
}

I would like to add another param into the Input:all()

{
  "param_1" => "value",
  "param_2" => "value",
  "param_3" => "value",
  "NEW_PARAM" => "NEW VALUE",
}
like image 539
user742736 Avatar asked Jun 06 '14 01:06

user742736


1 Answers

In laravel 5, you can use

Request::merge(['New Key' => 'New Value']);

or by using request() helper

request()->merge(['New Key' => 'New Value']);
like image 94
Muhammad Syauqy Avatar answered Nov 14 '22 22:11

Muhammad Syauqy