Last active
November 29, 2019 10:42
-
-
Save M-Abdullahi/4814cd005d9c7a1a86c88d4035c838ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validator::extend('encrypted_unique', function ($attribute, $value, $parameters, $validator) { | |
list ($table, $column, $ignore_id) = $parameters; // or hard-coded if fixed | |
$count = $validator->getPresenceVerifier()->getCount($table, $column, encrypt($value), $ignore_id); | |
return $count === 0; | |
}); | |
'identifier' => "encrypted_unique:table,column,$this_id" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment