mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-20 02:11:36 +00:00
23 lines
448 B
PHP
Executable File
23 lines
448 B
PHP
Executable File
<?php
|
|
|
|
namespace App\ValidationRules;
|
|
|
|
use Illuminate\Contracts\Validation\Rule;
|
|
|
|
class DomainRule implements Rule
|
|
{
|
|
public function passes($attribute, $value): bool
|
|
{
|
|
if ($value) {
|
|
return preg_match("/^(?!\-)(?:[a-zA-Z\d\-]{0,62}[a-zA-Z\d]\.){1,126}(?!\d+)[a-zA-Z\d]{1,63}$/", $value);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public function message(): string
|
|
{
|
|
return __('Domain is not valid');
|
|
}
|
|
}
|