marvinlabs / laravel-html-bootstrap-4

Bootstrap 4 fluent HTML builder
MIT License
42 stars 15 forks source link

Model relations binding #21

Open nesymno opened 6 years ago

nesymno commented 6 years ago

Hey! How to bind model with relations? Like... I have post and have seo info for it. So, when I bind model, it works ok, but inputs with relations always null... And validation errors don't show on relation inputs.

vpratfr commented 6 years ago

Can you give sample code?

nesymno commented 6 years ago
{{ bs()->formGroup(bs()->text('seo[keywords]'))->label('Keywords')->addClass('col-12') }}

I'm opening form, bind model. All data good, except relations. I just add value by myself, but it would be great if relations will fill automatically.

vpratfr commented 6 years ago

Will have a look.

In the meantime, how about using the functions to set default values manually?

->default($post->seo->keywords)

nesymno commented 6 years ago

@vpratfr yes of course.