Merkez validations
This commit is contained in:
23
app/Rules/DowranAgaAllowed.php
Normal file
23
app/Rules/DowranAgaAllowed.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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(__('Write a correct data please'));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user