regex, $value) > 0; } public function __toString() { return sprintf('regex:%s', $this->regex); } public function validate(string $attribute, mixed $value, Closure $fail): void { if (! $this->passes($attribute, $value)) { $fail(__('validation.regex', ['attribute' => __('permission name')])); } } }