Files
online.tbbank.gov.tm-larave…/app/Rules/DowranAgaAllowed.php
2024-09-07 05:23:12 +05:00

32 lines
705 B
PHP

<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
class DowranAgaAllowed implements ValidationRule
{
/**
* Run the validation rule.
*
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
*/
public function validate(string $attribute, mixed $value, Closure $fail): void
{
$pattern = "/^[a-zA-Z0-9\s\(\)\"\'\-\žŽäÄňŇöÖşŞüÜçÇýÝ\/,.]+$/u";
if (! preg_match($pattern, $value)) {
$fail($this->message());
}
}
/**
* Message
*/
public function message(): string
{
return __('Write a correct data please');
}
}