mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2025-01-30 22:31:14 +01:00
27 lines
495 B
PHP
27 lines
495 B
PHP
|
<?php
|
||
|
|
||
|
namespace Rakit\Validation\Rules;
|
||
|
|
||
|
use Rakit\Validation\Rule;
|
||
|
|
||
|
class Date extends Rule
|
||
|
{
|
||
|
|
||
|
protected $message = "The :attribute is not valid date format";
|
||
|
|
||
|
protected $fillable_params = ['format'];
|
||
|
|
||
|
protected $params = [
|
||
|
'format' => 'Y-m-d'
|
||
|
];
|
||
|
|
||
|
public function check($value)
|
||
|
{
|
||
|
$this->requireParameters($this->fillable_params);
|
||
|
|
||
|
$format = $this->parameter('format');
|
||
|
return date_create_from_format($format, $value) !== false;
|
||
|
}
|
||
|
|
||
|
}
|