%PDF- %PDF-
Direktori : /www/loslex_o/production/app/Rules/ |
Current File : /www/loslex_o/production/app/Rules/ForbiddenUsernames.php |
<?php namespace App\Rules; use Closure; use Illuminate\Contracts\Validation\ValidationRule; class ForbiddenUsernames implements ValidationRule { /** * Run the validation rule. * * @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail */ public function validate(string $attribute, mixed $value, Closure $fail): void { $forbidden = array_map('strtolower', config('auth.disabled_usernames')); if (in_array(strtolower($value), $forbidden)) { $fail('validation.custom.username')->translate(); } } }