Form model binding not working in blade components
Form model binding is not working when you create a form component:
@component('components.form', ['model' => $product ?? null, 'route' => 'products'])
@component('components.form-group', ['name' => 'name', 'label' => 'Product name:'])
{!! Form::text('name', null, ['class' => 'form-control']) !!}
@endcomponent
@endcomponent
And components/form.blade.php looks like this:
{!! Form::model($model, ['method' => 'PATCH', 'route' => [$route . '.update', $model->id]]) !!}
{!! $slot !!}
{!! Form::close() !!}
In this case the field values are not populating (the attributes are exist in the $model object). When I use Form::model() just where I make the fields, it's working fine. If I @include the form opener part, it's also working fine.
Thank you.
Form model binding not working in blade components
Form model binding is not working when you create a form component:
And components/form.blade.php looks like this:
In this case the field values are not populating (the attributes are exist in the $model object). When I use Form::model() just where I make the fields, it's working fine. If I @include the form opener part, it's also working fine.
Thank you.