netojose / laravel-bootstrap-4-forms

Bootstrap 4 forms for Laravel 5/6/7/8
MIT License
183 stars 58 forks source link

don't get default value #78

Closed rodevelop2 closed 5 years ago

rodevelop2 commented 5 years ago

i want add default value for input, like this in edit form {!!Form::text('name', __('validation.attributes.name') , $user->name)!!} this item works before, but don't work now, please fix this.

malyar-m commented 5 years ago

Hi there! I noticed a similar issue. Looks like that this problem caused in method:

FormBuilder.php:line 430

private function getValue()
{
        extract($this->get('name', 'value', 'formData'));
        if ($this->isRadioOrCheckbox()) {
            return $value;
        }

        if ($this->hasOldInput()) {
            return old($name, $value);
        }

        return $formData[$name] ?? null;
}

Return value return $formData[$name] ?? null; should be replaced with return $formData[$name] ?? $value;

netojose commented 5 years ago

Fixed on 3.0.4 version