laravel-ardent / ardent

Self-validating, secure and smart models for Laravel's Eloquent ORM
BSD 3-Clause "New" or "Revised" License
1.39k stars 211 forks source link

Match unique rules with no parameters #298

Open tdhsmith opened 8 years ago

tdhsmith commented 8 years ago

As it stands, the example provided in the README ('email' => 'required|email|unique',) doesn't work because buildUniqueExclusionRules is searching specifically for unique:, ending with a colon.

Presumably this isn't intentional, based on the later count(explode(':', $params[0])) check which currently would be impossible to trigger, so the string match has been adjusted.

That said, is there any concern of matching custom rules starting with 'unique'? The string check could be made more complicated to avoid this, but I personally think of it as a low priority concern.