Merge branch '5.3' of https://github.com/LaravelCollective/html into blade-directives

This commit is contained in:
Matt Lantz committed 2016-10-21 13:08:42 -04:00
commit da8ed049cf
6 files changed
+35 -13

No files matched your search

+1 -1
View File
@@ -1,9 +1,9 @@
language: php
php:
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm
sudo: false
+9 -9
View File
@@ -18,17 +18,17 @@
}
],
"require": {
"php": ">=5.5.9",
"illuminate/http": "5.2.*",
"illuminate/routing": "5.2.*",
"illuminate/session": "5.2.*",
"illuminate/support": "5.2.*",
"illuminate/view": "5.2.*"
"php": ">=5.6.4",
"illuminate/http": "5.3.*",
"illuminate/routing": "5.3.*",
"illuminate/session": "5.3.*",
"illuminate/support": "5.3.*",
"illuminate/view": "5.3.*"
},
"require-dev": {
"illuminate/database": "5.2.*",
"mockery/mockery": "~0.9",
"phpunit/phpunit": "~4.0"
"illuminate/database": "5.3.*",
"mockery/mockery": "~0.9.4",
"phpunit/phpunit": "~5.4"
},
"autoload": {
"psr-4": {
+3 -2
View File
@@ -41,7 +41,8 @@ trait FormAccessible
return $this->mutateFormAttribute($key, $value);
}
return $value;
// No form mutator, let the model resolve this
return data_get($this, $key);
}
/**
@@ -54,7 +55,7 @@ trait FormAccessible
$methods = $this->getReflection()->getMethods(ReflectionMethod::IS_PUBLIC);
$mutator = collect($methods)
->first(function ($index, ReflectionMethod $method) use ($key) {
->first(function (ReflectionMethod $method) use ($key) {
return $method->getName() == 'form' . Str::studly($key) . 'Attribute';
});
+1 -1
View File
@@ -1107,7 +1107,7 @@ class FormBuilder
protected function getModelValueAttribute($name)
{
if (method_exists($this->model, 'getFormValue')) {
return $this->model->getFormValue($name);
return $this->model->getFormValue($this->transformKey($name));
}
return data_get($this->model, $this->transformKey($name));
+12
View File
@@ -277,6 +277,18 @@ class HtmlBuilder
return str_replace('@', '@', $this->obfuscate($email));
}
/**
* Generates non-breaking space entities based on number supplied.
*
* @param int $num
*
* @return string
*/
public function nbsp($num = 1)
{
return str_repeat(' ', $num);
}
/**
* Generate an ordered list of items.
*
+9
View File
@@ -24,6 +24,9 @@ class FormAccessibleTest extends PHPUnit_Framework_TestCase
$this->modelData = [
'string' => 'abcdefghijklmnop',
'email' => 'tj@tjshafer.com',
'address' => [
'street' => 'abcde st'
],
'created_at' => $this->now,
'updated_at' => $this->now,
];
@@ -43,6 +46,12 @@ class FormAccessibleTest extends PHPUnit_Framework_TestCase
$this->assertEquals($model->getFormValue('created_at'), $this->now->timestamp);
}
public function testItCanGetRelatedValueForForms()
{
$model = new ModelThatUsesForms($this->modelData);
$this->assertEquals($model->getFormValue('address.street'), 'abcde st');
}
public function testItCanStillMutateValuesForViews()
{
$model = new ModelThatUsesForms($this->modelData);