Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Form model binding not working in blade components #8

Open
aviqbaihaqy opened this issue Sep 5, 2019 · 1 comment
Open

Form model binding not working in blade components #8

aviqbaihaqy opened this issue Sep 5, 2019 · 1 comment

Comments

@aviqbaihaqy
Copy link

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.

@crynobone
Copy link
Member

Feel free to submit a PR to add the support for this, the feature was cloned from laravelcollective/html.

# for free to join this conversation on GitHub. Already have an account? # to comment
Development

No branches or pull requests

2 participants