From 4d3144e817848dc66eaed41dc14cb3b048868ce8 Mon Sep 17 00:00:00 2001 From: Jonathan Martin Date: Tue, 19 Dec 2017 14:11:36 +0000 Subject: [PATCH] [5.6] Allow chaining of the $request->merge() method (#22479) 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? --- src/Illuminate/Http/Request.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Http/Request.php b/src/Illuminate/Http/Request.php index 89f292517eb2..35f489123e5f 100644 --- a/src/Illuminate/Http/Request.php +++ b/src/Illuminate/Http/Request.php @@ -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; } /**