website/vendor/alexgarrett/violin/src/Rules/RegexRule.php

24 lines
385 B
PHP
Executable File

<?php
namespace Violin\Rules;
use Violin\Contracts\RuleContract;
class RegexRule implements RuleContract
{
public function run($value, $input, $args)
{
return (bool) preg_match($args[0], $value);
}
public function error()
{
return '{field} was not in the correct format.';
}
public function canSkip()
{
return true;
}
}