protected function validate(Validator $v) { $v->whenNotNull(function (Validator $v) { $v->allow(function (Validator $v) { $v->notInt('The value is not a valid UNIX-TimeStamp'); })->allow(function (Validator $v) { $v->notDateTime('The value is not a valid Date and Time string'); })->notPassed('The value is not a valid Date and/or Time'); }); }
protected function validate(Validator $v) { $v->whenSet(function (Validator $v) { $v->notInt('Value has to be a number')->when($this->isSigned(), function (Validator $v) { $v->outOf(static::MIN, static::MAX, sprintf('Value has to be between %d and %d', static::MIN, static::MAX)); })->otherwise(function (Validator $v) { $v->outOf(static::UNSIGNED_MIN, static::UNSIGNED_MAX, sprintf('Value has to be between %d and %d', static::UNSIGNED_MIN, static::UNSIGNED_MAX)); }); }); return parent::validate($v); }
protected function validate(Validator $v) { $v->whenNotNull(function (Validator $v) { $v->notInt('Value has to be an integer')->outOf(static::MIN, static::MAX, sprintf('Value has to be between %d and %d', static::MIN, static::MAX)); }); }
protected function validate(Validator $v) { $v->whenNotNull(function (Validator $v) { $v->notInt('The value needs to be an int representing a UNIX time stamp'); }); }