Closed vladflip closed 6 years ago
@vladflip I just released an alpha version. Please check it out.
Someone raised the same issue on Twitter: https://twitter.com/themsaid/status/1031449131879985152
The basic idea is that the model should be consistent regardless the role of the user, the action being taken (the title
shouldn't be longer than 100 characters, the price should be at least 0 and numeric, the slug should match a regex rule). Can you think of some edge cases where this is not true?
We can split the validation rules in two groups
For a registration form
Of course, if you want to send the "terms" checkbox value to the server, you can, but I'm just trying to make my point.
I think roles are out from escope this package.
You're right @robsontenorio. User roles are out of the scope of this package but validation rules are right at the core. The questions is this: can user roles change validation rules?
I will close this until someone provides a real scenario where this is required.
What about a field customization per request? There are cases when you need to validate the fields differently (basic example is admin user). This is done with form requests. So I’m guessing this package should expose a static method in a model which returns new customized rules (including complete rule removal) which you can use in a form request.