Open brazorf opened 8 years ago
I use:
$this->validator->with($data)->passesOrFail('change_password');
protected $rules = [
'create' => [
// rules
],
'update' => [
// rules
],
'change_password' => [
// only username and password rules
]
];
It's nice to have separate create and update use cases, but i was thinking it would be way better to add the possibility to customize them.
To give you an example, think about a User model like this
On certain use cases (i.e. change password) you would only want to validate username and password fields. On the other hand, you would validate email, age, phone when the user is updating his own profile. Each use case will have probably the same syntax rule, but may differ on the
required
rule.So what about something like this:
I'd like to hear your thoughts about this.