Laravel 5.6 updates
Travis config update Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
20
vendor/laravelcollective/html/composer.json
vendored
20
vendor/laravelcollective/html/composer.json
vendored
@@ -18,17 +18,17 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.0.0",
|
||||
"illuminate/http": "5.5.*",
|
||||
"illuminate/routing": "5.5.*",
|
||||
"illuminate/session": "5.5.*",
|
||||
"illuminate/support": "5.5.*",
|
||||
"illuminate/view": "5.5.*"
|
||||
"php": ">=7.1.3",
|
||||
"illuminate/http": "5.6.*",
|
||||
"illuminate/routing": "5.6.*",
|
||||
"illuminate/session": "5.6.*",
|
||||
"illuminate/support": "5.6.*",
|
||||
"illuminate/view": "5.6.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"illuminate/database": "5.5.*",
|
||||
"mockery/mockery": "~0.9.4",
|
||||
"phpunit/phpunit": "~5.4"
|
||||
"illuminate/database": "5.6.*",
|
||||
"mockery/mockery": "~1.0",
|
||||
"phpunit/phpunit": "~7.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -40,7 +40,7 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "5.5-dev"
|
||||
"dev-master": "5.6-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
|
@@ -49,11 +49,11 @@ trait FormAccessible
|
||||
unset($keys[0]);
|
||||
$key = implode('.', $keys);
|
||||
|
||||
if ($this->hasFormMutator($key)) {
|
||||
if (method_exists($relatedModel, 'hasFormMutator') && $key !== '' && $relatedModel->hasFormMutator($key)) {
|
||||
return $relatedModel->getFormValue($key);
|
||||
}
|
||||
|
||||
return data_get($relatedModel, $key);
|
||||
return data_get($relatedModel, empty($key)? null: $key);
|
||||
}
|
||||
|
||||
// No form mutator, let the model resolve this
|
||||
@@ -81,7 +81,7 @@ trait FormAccessible
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasFormMutator($key)
|
||||
public function hasFormMutator($key)
|
||||
{
|
||||
$methods = $this->getReflection()->getMethods(ReflectionMethod::IS_PUBLIC);
|
||||
|
||||
|
133
vendor/laravelcollective/html/src/FormBuilder.php
vendored
133
vendor/laravelcollective/html/src/FormBuilder.php
vendored
@@ -49,6 +49,12 @@ class FormBuilder
|
||||
*/
|
||||
protected $csrfToken;
|
||||
|
||||
/**
|
||||
* Consider Request variables while auto fill.
|
||||
* @var bool
|
||||
*/
|
||||
protected $considerRequest = false;
|
||||
|
||||
/**
|
||||
* The session store implementation.
|
||||
*
|
||||
@@ -108,6 +114,7 @@ class FormBuilder
|
||||
* @param \Illuminate\Contracts\Routing\UrlGenerator $url
|
||||
* @param \Illuminate\Contracts\View\Factory $view
|
||||
* @param string $csrfToken
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(HtmlBuilder $html, UrlGenerator $url, Factory $view, $csrfToken, Request $request = null)
|
||||
{
|
||||
@@ -190,7 +197,7 @@ class FormBuilder
|
||||
{
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the current model instance on the form builder.
|
||||
*
|
||||
@@ -329,6 +336,20 @@ class FormBuilder
|
||||
return $this->input('password', $name, '', $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a range input field.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @param array $options
|
||||
*
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function range($name, $value = null, $options = [])
|
||||
{
|
||||
return $this->input('range', $name, $value, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a hidden input field.
|
||||
*
|
||||
@@ -464,6 +485,10 @@ class FormBuilder
|
||||
*/
|
||||
public function time($name, $value = null, $options = [])
|
||||
{
|
||||
if ($value instanceof DateTime) {
|
||||
$value = $value->format('H:i');
|
||||
}
|
||||
|
||||
return $this->input('time', $name, $value, $options);
|
||||
}
|
||||
|
||||
@@ -481,6 +506,24 @@ class FormBuilder
|
||||
return $this->input('url', $name, $value, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a week input field.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @param array $options
|
||||
*
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function week($name, $value = null, $options = [])
|
||||
{
|
||||
if ($value instanceof DateTime) {
|
||||
$value = $value->format('Y-\WW');
|
||||
}
|
||||
|
||||
return $this->input('week', $name, $value, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a file input field.
|
||||
*
|
||||
@@ -527,7 +570,7 @@ class FormBuilder
|
||||
// the element. Then we'll create the final textarea elements HTML for us.
|
||||
$options = $this->html->attributes($options);
|
||||
|
||||
return $this->toHtmlString('<textarea' . $options . '>' . e($value). '</textarea>');
|
||||
return $this->toHtmlString('<textarea' . $options . '>' . e($value, false). '</textarea>');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -694,7 +737,7 @@ class FormBuilder
|
||||
*/
|
||||
public function getSelectOption($display, $value, $selected, array $attributes = [], array $optgroupAttributes = [])
|
||||
{
|
||||
if (is_array($display)) {
|
||||
if (is_iterable($display)) {
|
||||
return $this->optionGroup($display, $value, $selected, $optgroupAttributes, $attributes);
|
||||
}
|
||||
|
||||
@@ -709,20 +752,23 @@ class FormBuilder
|
||||
* @param string $selected
|
||||
* @param array $attributes
|
||||
* @param array $optionsAttributes
|
||||
* @param integer $level
|
||||
*
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
protected function optionGroup($list, $label, $selected, array $attributes = [], array $optionsAttributes = [])
|
||||
protected function optionGroup($list, $label, $selected, array $attributes = [], array $optionsAttributes = [], $level = 0)
|
||||
{
|
||||
$html = [];
|
||||
|
||||
$space = str_repeat(" ", $level);
|
||||
foreach ($list as $value => $display) {
|
||||
$optionAttributes = $optionsAttributes[$value] ?? [];
|
||||
|
||||
$html[] = $this->option($display, $value, $selected, $optionAttributes);
|
||||
if (is_iterable($display)) {
|
||||
$html[] = $this->optionGroup($display, $value, $selected, $attributes, $optionAttributes, $level+5);
|
||||
} else {
|
||||
$html[] = $this->option($space.$display, $value, $selected, $optionAttributes);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->toHtmlString('<optgroup label="' . e($label) . '"' . $this->html->attributes($attributes) . '>' . implode('', $html) . '</optgroup>');
|
||||
return $this->toHtmlString('<optgroup label="' . e($space.$label, false) . '"' . $this->html->attributes($attributes) . '>' . implode('', $html) . '</optgroup>');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -743,7 +789,7 @@ class FormBuilder
|
||||
|
||||
$string = '<option' . $this->html->attributes($options) . '>';
|
||||
if ($display !== null) {
|
||||
$string .= e($display) . '</option>';
|
||||
$string .= e($display, false) . '</option>';
|
||||
}
|
||||
|
||||
return $this->toHtmlString($string);
|
||||
@@ -766,7 +812,7 @@ class FormBuilder
|
||||
'value' => '',
|
||||
];
|
||||
|
||||
return $this->toHtmlString('<option' . $this->html->attributes($options) . '>' . e($display) . '</option>');
|
||||
return $this->toHtmlString('<option' . $this->html->attributes($options) . '>' . e($display, false) . '</option>');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -868,7 +914,7 @@ class FormBuilder
|
||||
return $this->getRadioCheckedState($name, $value, $checked);
|
||||
|
||||
default:
|
||||
return $this->getValueAttribute($name) === $value;
|
||||
return $this->compareValues($name, $value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -921,7 +967,21 @@ class FormBuilder
|
||||
return $checked;
|
||||
}
|
||||
|
||||
return $this->getValueAttribute($name) === $value;
|
||||
return $this->compareValues($name, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the provide value loosely compares to the value assigned to the field.
|
||||
* Use loose comparison because Laravel model casting may be in affect and therefore
|
||||
* 1 == true and 0 == false.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
protected function compareValues($name, $value)
|
||||
{
|
||||
return $this->getValueAttribute($name) == $value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -965,6 +1025,24 @@ class FormBuilder
|
||||
return $this->input('image', $name, null, $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a month input field.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @param array $options
|
||||
*
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function month($name, $value = null, $options = [])
|
||||
{
|
||||
if ($value instanceof DateTime) {
|
||||
$value = $value->format('Y-m');
|
||||
}
|
||||
|
||||
return $this->input('month', $name, $value, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a color input field.
|
||||
*
|
||||
@@ -1175,7 +1253,7 @@ class FormBuilder
|
||||
if ($hasNullMiddleware
|
||||
&& is_null($old)
|
||||
&& is_null($value)
|
||||
&& ! is_null($this->view->shared('errors'))
|
||||
&& !is_null($this->view->shared('errors'))
|
||||
&& count($this->view->shared('errors')) > 0
|
||||
) {
|
||||
return null;
|
||||
@@ -1183,7 +1261,7 @@ class FormBuilder
|
||||
}
|
||||
|
||||
$request = $this->request($name);
|
||||
if (! is_null($request) && $name !== '_method') {
|
||||
if (! is_null($request) && $name != '_method') {
|
||||
return $request;
|
||||
}
|
||||
|
||||
@@ -1196,6 +1274,15 @@ class FormBuilder
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Take Request in fill process
|
||||
* @param bool $consider
|
||||
*/
|
||||
public function considerRequest($consider = true)
|
||||
{
|
||||
$this->considerRequest = $consider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value from current Request
|
||||
* @param $name
|
||||
@@ -1203,7 +1290,11 @@ class FormBuilder
|
||||
*/
|
||||
protected function request($name)
|
||||
{
|
||||
if (! isset($this->request)) {
|
||||
if (!$this->considerRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!isset($this->request)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1241,16 +1332,16 @@ class FormBuilder
|
||||
$key = $this->transformKey($name);
|
||||
$payload = $this->session->getOldInput($key);
|
||||
|
||||
if (! is_array($payload)) {
|
||||
if (!is_array($payload)) {
|
||||
return $payload;
|
||||
}
|
||||
|
||||
if (! in_array($this->type, ['select', 'checkbox'])) {
|
||||
if (! isset($this->payload[$key])) {
|
||||
if (!in_array($this->type, ['select', 'checkbox'])) {
|
||||
if (!isset($this->payload[$key])) {
|
||||
$this->payload[$key] = collect($payload);
|
||||
}
|
||||
|
||||
if (! empty($this->payload[$key])) {
|
||||
if (!empty($this->payload[$key])) {
|
||||
$value = $this->payload[$key]->shift();
|
||||
return $value;
|
||||
}
|
||||
@@ -1267,7 +1358,7 @@ class FormBuilder
|
||||
*/
|
||||
public function oldInputIsEmpty()
|
||||
{
|
||||
return (isset($this->session) && count($this->session->getOldInput()) === 0);
|
||||
return (isset($this->session) && count((array) $this->session->getOldInput()) === 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -94,7 +94,7 @@ class HtmlBuilder
|
||||
{
|
||||
$defaults = ['media' => 'all', 'type' => 'text/css', 'rel' => 'stylesheet'];
|
||||
|
||||
$attributes = array_merge($attributes, $defaults);
|
||||
$attributes = array_merge($defaults, $attributes);
|
||||
|
||||
$attributes['href'] = $this->url->asset($url, $secure);
|
||||
|
||||
@@ -387,7 +387,7 @@ class HtmlBuilder
|
||||
if (is_array($value)) {
|
||||
return $this->nestedListing($key, $type, $value);
|
||||
} else {
|
||||
return '<li>' . e($value) . '</li>';
|
||||
return '<li>' . e($value, false) . '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,8 +455,12 @@ class HtmlBuilder
|
||||
return $value ? $key : '';
|
||||
}
|
||||
|
||||
if (is_array($value) && $key === 'class') {
|
||||
return 'class="' . implode(' ', $value) . '"';
|
||||
}
|
||||
|
||||
if (! is_null($value)) {
|
||||
return $key . '="' . e($value) . '"';
|
||||
return $key . '="' . e($value, false) . '"';
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user