Fix form builder with model binding.

This commit is contained in:
Taylor Otwell committed 2013-08-01 08:25:31 -05:00
1 parent 3809fee0a7
commit fdb891e180
1 file changed
+13 -2
+13 -2
View File
@@ -618,7 +618,7 @@ class FormBuilder {
{ {
if ( ! $this->oldInputIsEmpty() and is_null($this->old($name))) return false; if ( ! $this->oldInputIsEmpty() and is_null($this->old($name))) return false;
if (is_null($this->old($name))) return $checked; if ($this->missingOldAndModel($name)) return $checked;
return (bool) $this->getValueAttribute($name); return (bool) $this->getValueAttribute($name);
} }
@@ -633,11 +633,22 @@ class FormBuilder {
*/ */
protected function getRadioCheckedState($name, $value, $checked) protected function getRadioCheckedState($name, $value, $checked)
{ {
if (is_null($this->old($name))) return $checked; if ($this->missingOldAndModel($name)) return $checked;
return $this->getValueAttribute($name) == $value; return $this->getValueAttribute($name) == $value;
} }
/**
* Determine if old input or model input exists for a key.
*
* @param string $name
* @return bool
*/
protected function missingOldAndModel($name)
{
return (is_null($this->old($name)) and is_null($this->getModelValueAttribute($name)));
}
/** /**
* Create a HTML reset input element. * Create a HTML reset input element.
* *