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

Custom validation rule in the model #214

Closed
snuzi opened this issue Apr 26, 2019 · 1 comment
Closed

Custom validation rule in the model #214

snuzi opened this issue Apr 26, 2019 · 1 comment

Comments

@snuzi
Copy link

snuzi commented Apr 26, 2019

Hi there,
I found this library very useful, but I am finding it very difficult to set some custom rules in the model.
Ex: I have an attribute keywords which should store some keywords comma separated "word1,word2".
I want to have make a function to perform a custom rule for keywords attribute. I could find a workaround to put the custom validation rule in the controller (rest API response) like:
$request-> validate(['keywords' => new MyValidation()])

I would appreciate if this library supports that case, or if anyone managed to make it work in the model.
Thanks

@dwightwatson
Copy link
Owner

I think this is the same issue as #177 - where this library validates content through accessors/mutators rather than the request input or raw database data. This is unlikely to change any time soon I'm afraid, but discussion can continue in the other issue.

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

No branches or pull requests

2 participants