This repository has been archived by the owner on Feb 26, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 119
Populate model bound forms using form model accessor if set #111
Open
jonjrwhite
wants to merge
7
commits into
adamwathan:master
Choose a base branch
from
webhappens:enable-form-model-accessor
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Populate model bound forms using form model accessor if set #111
jonjrwhite
wants to merge
7
commits into
adamwathan:master
from
webhappens:enable-form-model-accessor
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.