Add all files
This commit is contained in:
16
app/Rules/Domain.php
Normal file
16
app/Rules/Domain.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Rules;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
|
||||
class Domain implements ValidationRule
|
||||
{
|
||||
public function validate(string $attribute, mixed $value, Closure $fail): void
|
||||
{
|
||||
if (!preg_match('/^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$/i', $value)) {
|
||||
$fail('The :attribute is not a valid domain.');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user