FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merge pull request #2680 from bryannielsen/4.0 · JavaDevl/framework@bbf77cc · GitHub

Commit bbf77cc

Browse files
committed
Merge pull request laravel#2680 from bryannielsen/4.0
Modify Input::all() to work with nested input arrays
2 parents 5076824 + 35b6a0f commit bbf77cc

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎src/Illuminate/Http/Request.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function has($key)
174174
*/
175175
public function all()
176176
{
177-
return $this->input() + $this->files->all();
177+
return array_merge_recursive($this->input(), $this->files->all());
178178
}
179179

180180
/**

‎tests/Http/HttpRequestTest.php‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,14 @@ public function testAllInputReturnsInputAndFiles()
238238
}
239239

240240

241+
public function testAllInputReturnsNestedInputAndFiles()
242+
{
243+
$file = $this->getMock('Symfony\Component\HttpFoundation\File\UploadedFile', null, array(__FILE__, 'photo.jpg'));
244+
$request = Request::create('/?boom=breeze', 'GET', array('foo' => array('bar' => 'baz')), array(), array('foo' => array('photo' => $file)));
245+
$this->assertEquals(array('foo' => array('bar' => 'baz', 'photo' => $file), 'boom' => 'breeze'), $request->all());
246+
}
247+
248+
241249
public function testOldMethodCallsSession()
242250
{
243251
$request = Request::create('/', 'GET');

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL