seems to work just fine now, needs translations

This commit is contained in:
spencerrlongg 2024-11-13 21:54:25 -06:00
parent 25163d1756
commit 7e7cbc4cc8
2 changed files with 8 additions and 6 deletions

View file

@ -17,12 +17,12 @@ class AlphaEncrypted implements ValidationRule
{
try {
$decrypted = Crypt::decrypt($value);
dump($decrypted);
if (!ctype_alpha($decrypted)) {
if (!ctype_alpha($decrypted) && !is_null($decrypted)) {
$fail($attribute.' is not alphabetic.');
}
} catch (\Exception $e) {
$fail($e->getMessage());
report($e);
$fail('something went wrong.');
}
}
}

View file

@ -16,13 +16,15 @@ class NumericEncrypted implements ValidationRule
*/
public function validate(string $attribute, mixed $value, Closure $fail): void
{
try {
$value = Crypt::decrypt($value);
if (!is_numeric($value)) {
$decrypted = Crypt::decrypt($value);
if (!is_numeric($decrypted) && !is_null($decrypted)) {
$fail($attribute.' is not numeric.');
}
} catch (\Exception $e) {
$fail($e->getMessage());
report($e->getMessage());
$fail('something went wrong');
}
}
}