Skip to content

Commit

Permalink
[5.6] Allow chaining of the $request->merge() method (#22479)
Browse files Browse the repository at this point in the history
I found that it would be nice to be able to chain methods on the request. eg. `$request->merge([])->only()`, but it is not possible to do this currently and I cannot see a reason why this should not be allowed?
  • Loading branch information
Jono20201 authored and taylorotwell committed Dec 19, 2017
1 parent 2239858 commit 4d3144e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Illuminate/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,22 +287,26 @@ public function userAgent()
* Merge new input into the current request's input array.
*
* @param array $input
* @return void
* @return \Illuminate\Http\Request
*/
public function merge(array $input)
{
$this->getInputSource()->add($input);

return $this;
}

/**
* Replace the input for the current request.
*
* @param array $input
* @return void
* @return \Illuminate\Http\Request
*/
public function replace(array $input)
{
$this->getInputSource()->replace($input);

return $this;
}

/**
Expand Down

0 comments on commit 4d3144e

Please sign in to comment.