Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel change input value

In laravel, we can get the input value via Input::get('inputname'). I try to change the value by doing this Input::get('inputname') = "new value";. But then, I get the error message saying Can't use function return value in write context.

Is it possible for us change the input value so that when later calling on Input::get('inputname') will get the new amended value?

Thanks.

like image 482
user1995781 Avatar asked Apr 15 '14 02:04

user1995781


1 Answers

You can use Input::merge() to replace single items.

Input::merge(['inputname' => 'new value']); 

Or use Input::replace() to replace the entire input array.

Input::replace(['inputname' => 'new value']); 

Here's a link to the documentation

like image 171
Brad Avatar answered Sep 28 '22 14:09

Brad