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.
If you mean you want to overwrite input data, you can try doing:
You can use
Input::merge()
to replace single items.Or use
Input::replace()
to replace the entire input array.Here's a link to the documentation
If you're looking to do this in Laravel 5, you can use the
merge()
method from theRequest
class:I also found this problem, I can solve it with the following code:
Regards
Try this,it will help you.