Laravel 5: How to modify Request values | How to "artificially" add values to Request array | How to dynamically add params to Request array. You can use the merge() method on the $request object. In spite of the methods name, it actually replaces any values associated with the member names specified by the keys of the parameter rather than concatenating their values or anything like that.
use Illuminate\Http\Request;
protected $request;
public function __construct(Request $request)
{
$this->request = $request;
}
$this->request->merge(["custom" => "New Custom Value"]);
..
No comments:
Post a Comment