Compare commits

...
4 Commits
Author SHA1 Message Date
Adam Engebretson f1eddc7a78 Updating Illuminate Depends
Signed-off-by: Adam Engebretson <adam@enge.me>
2015-05-21 11:45:14 -05:00
Adam Engebretson 745c10226d Adding branch alias
Signed-off-by: Adam Engebretson <adam@enge.me>
2015-05-21 11:44:56 -05:00
Tom a0a763779d Merge pull request #33 from garygreen/fix-model-bindings
Fix model form-binding with array with objects and object with arrays.
2015-05-06 08:48:56 -07:00
Gary e4b32919a3 Fix model form-binding with array with objects and object with arrays. 2015-04-25 13:14:08 +01:00
3 changed files with 24 additions and 13 deletions

No files matched your search

+11 -5
View File
@@ -13,10 +13,10 @@
],
"require": {
"php": ">=5.4.0",
"illuminate/http": "~5.0",
"illuminate/routing": "~5.0",
"illuminate/session": "~5.0",
"illuminate/support": "~5.0"
"illuminate/http": "~5.1",
"illuminate/routing": "~5.1",
"illuminate/session": "~5.1",
"illuminate/support": "~5.1"
},
"require-dev": {
"mockery/mockery": "~0.9",
@@ -29,5 +29,11 @@
"files": [
"src/helpers.php"
]
}
},
"extra": {
"branch-alias": {
"dev-master": "5.1-dev"
}
},
"minimum-stability": "dev"
}
+1 -8
View File
@@ -935,14 +935,7 @@ class FormBuilder {
*/
protected function getModelValueAttribute($name)
{
if (is_object($this->model))
{
return object_get($this->model, $this->transformKey($name));
}
elseif (is_array($this->model))
{
return array_get($this->model, $this->transformKey($name));
}
return data_get($this->model, $this->transformKey($name));
}
/**
+12
View File
@@ -137,6 +137,18 @@ class FormBuilderTest extends PHPUnit_Framework_TestCase {
}
public function testFormRepopulationWithMixOfArraysAndObjects()
{
$this->formBuilder->model(['user' => (object)['password' => 'apple']]);
$input = $this->formBuilder->text('user[password]');
$this->assertEquals('<input name="user[password]" type="text" value="apple">', $input);
$this->formBuilder->model((object)['letters' => ['a', 'b', 'c']]);
$input = $this->formBuilder->text('letters[1]');
$this->assertEquals('<input name="letters[1]" type="text" value="b">', $input);
}
public function testFormPassword()
{
$form1 = $this->formBuilder->password('foo');