Skip to content
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

Add after validation hook #22

Merged
merged 5 commits into from
Mar 22, 2019
Merged

Add after validation hook #22

merged 5 commits into from
Mar 22, 2019

Conversation

mikaelpopowicz
Copy link
Contributor

Add the Laravel validation after hook.

Implement the afterValidate(Validator $validator, array $inputs) method in FormValidator child class.

Example :

use Illuminate\Contracts\Validation\Validator;

class ChildForm extends FormValidator
{
    ...

    protected function afterValidate(Validator $validator, array $inputs)
    {
        if ($this->somethingElseIsInvalid()) {
            $validator->errors()->add('field', 'Something is wrong with this field!');
        }
    }
}

@mfrancois
Copy link
Member

Bonjour @mikaelpopowicz,

Peux tu ajouter le testing associé à ton ajout de afterValidate stp?

@mfrancois mfrancois merged commit c062ce3 into Distilleries:master Mar 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants