-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added events. #9
Conversation
I would of done this in the performValidation method but doesn't always get called (Having looked at saving method) Passing the model allows the event handler to know what class it is and what is dirty on the model, no other information I think is necessary. I was going to just add a constructor and assign Model::getEventDispatcher() locally to the instance but the Facade is fine and testable.
Thanks for doing this. A couple of things;
I apologise for the delay in responding, am currently travelling. Really appreciate the PR. |
I agree on the naming consistency. The event can return false is the handler does, which also means the saving method does need to call it. I will have to double check now I think of it the method is "until" instead if "fire" will check again.— On Wed, Jun 11, 2014 at 5:49 AM, Dwight Watson notifications@github.com
|
Ok, I want your input on this if possible. There is 2 ways this can be done, we can use file and specify the $halt parameter and get all the responses. Or we can use until and that returns the first non-null value returned to us. Using until I believe would be best, and therefore callbacks would only return false if not to proceed, would need to explicitly say do not return any other value. |
I'm going to have a good read up on events in Laravel and get back to you on this one. At a glance |
|
Ok the facade exists anyway in the support package but I will add it. Are you wanting the validated to get called directly after the validating event? Or after the performValidation method? |
I suppose it should be called after performValidation as that is when validation will have completed. Also, would you be able to target this to the develop branch? Going to put this into the 0.8.x release with a few other substantial changes.
|
I would of done this in the performValidation method but doesn't always
get called (Having looked at saving method)
Passing the model allows the event handler to know what class it is and
what is dirty on the model, no other information I think is necessary.
I was going to just add a constructor and assign
Model::getEventDispatcher() locally to the instance but the Facade is
fine and testable.