You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 26, 2018. It is now read-only.
I have some forms where the user is entering data destined to two separate Model objects. In particular, an Address model is used throughout my code, being bound to various other parent Models via Laravel's polymorphic relationship. Since the code repeats everywhere, I have a Blade template for the Address portion of the form, so that form partial can't make reference to any parent model by name, so I feed it the Address model directly. I using a small trick to allow binding, by calling BootForm::bind() twice, once before each form partial.
Here is an example from one update form for a model (note in this case providing an Address is optional and might not exist, hence the conditional check)
Doing this, it just occurs to me that it would be swell and simpler if one could pass multiple models to the bind() method. I am aware that any attributes with the same name would intersect, and I think only the latter would be picked up. Still, it could be useful! In particular, the above solution obligates me to keep the two models in separated segregated sections in my form, whereas someone might want to mix child model fields in the middle of their form inside another model.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have some forms where the user is entering data destined to two separate Model objects. In particular, an Address model is used throughout my code, being bound to various other parent Models via Laravel's polymorphic relationship. Since the code repeats everywhere, I have a Blade template for the Address portion of the form, so that form partial can't make reference to any parent model by name, so I feed it the Address model directly. I using a small trick to allow binding, by calling BootForm::bind() twice, once before each form partial.
Here is an example from one update form for a model (note in this case providing an Address is optional and might not exist, hence the conditional check)
Here's a similar example from another form (here Address always exists):
Doing this, it just occurs to me that it would be swell and simpler if one could pass multiple models to the bind() method. I am aware that any attributes with the same name would intersect, and I think only the latter would be picked up. Still, it could be useful! In particular, the above solution obligates me to keep the two models in separated segregated sections in my form, whereas someone might want to mix child model fields in the middle of their form inside another model.
The text was updated successfully, but these errors were encountered: