Skip to content
This repository has been archived by the owner on Feb 26, 2018. It is now read-only.

Populate model bound forms using form model accessor if set #111

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Populate model bound forms using form model accessor if set #111

wants to merge 7 commits into from

Conversation

jonjrwhite
Copy link

This change enables use of Laravel's Form Model Accessors as detailed in the below documentation (documentation refers to 5.2, changes developed and tested in 5.3)
https://laravelcollective.com/docs/5.2/html#form-model-binding

The additional code uses the Form Model Accessor only if the method exists otherwise reverting to the original behaviour of using the standard model accessor.
This should mean that existing implementations are unaffected by the change.

The advantage of this change is that the value returned for binding a model to a form can be handled separately to the value returned by the standard model accessor. In my case I wish the value for the date attribute of one of my models to be formatted as a string when populating form fields, but to be a carbon date object for use in my reporting and metrics.

@coveralls
Copy link

coveralls commented Dec 12, 2016

Coverage Status

Coverage decreased (-0.2%) to 94.55% when pulling 75502df on webhappens:enable-form-model-accessor into da9e21c on adamwathan:master.

@coveralls
Copy link

coveralls commented Dec 12, 2016

Coverage Status

Coverage decreased (-0.2%) to 94.55% when pulling e1c965b on webhappens:enable-form-model-accessor into da9e21c on adamwathan:master.

@coveralls
Copy link

coveralls commented Dec 13, 2016

Coverage Status

Coverage increased (+0.02%) to 94.787% when pulling 7527fef on webhappens:enable-form-model-accessor into da9e21c on adamwathan:master.

@coveralls
Copy link

coveralls commented Dec 13, 2016

Coverage Status

Coverage increased (+0.02%) to 94.787% when pulling c0a5f6a on webhappens:enable-form-model-accessor into da9e21c on adamwathan:master.

@coveralls
Copy link

coveralls commented Dec 14, 2016

Coverage Status

Coverage decreased (-5.9%) to 88.889% when pulling ab3ab61 on webhappens:enable-form-model-accessor into da9e21c on adamwathan:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-2.1%) to 92.658% when pulling abc61f9 on webhappens:enable-form-model-accessor into da9e21c on adamwathan:master.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants