Is it possible to bind a form with a model that has relationships? For example I have a Order model that has a one to many with a Details model. That would save a lot of time with
@foreach($order->details as $detail)
{{ Form::text('product_name', Input::old('product_name') ? Input::old('product_name') : detail->product_name)
@endforeach
For a one-to-one
relation it's possible to use something like this:
Form::text('detail[product_name]')
In this case $order->detail->product_name
will be populated in the given text box if an instance of Order
model is bound to the from
using Form::model($order)
with the related model Detail
but it may not possible for one-to-many
because simply there will be a collection and you need a loop.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With