mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2025-02-10 19:50:09 +01:00
22 lines
405 B
PHP
22 lines
405 B
PHP
|
<?php
|
||
|
|
||
|
namespace Rakit\Validation\Rules;
|
||
|
|
||
|
use Rakit\Validation\Rule;
|
||
|
|
||
|
class Regex extends Rule
|
||
|
{
|
||
|
|
||
|
protected $message = "The :attribute is not valid format";
|
||
|
|
||
|
protected $fillable_params = ['regex'];
|
||
|
|
||
|
public function check($value)
|
||
|
{
|
||
|
$this->requireParameters($this->fillable_params);
|
||
|
$regex = $this->parameter('regex');
|
||
|
return preg_match($regex, $value) > 0;
|
||
|
}
|
||
|
|
||
|
}
|