1. Go to this page and download the library: Download ylab/validation library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
/**
* При необходимости в компоненте можно реализовать дополнительные правила валидации, например, данный валидатор
* проверяет наличие пользователя в базе данных по ID.
*/
$this->oValidator->addExtension('user_exists', function($attribute, $value, $parameters, $validator) {
$arValidate = UserTable::getList([
'select' => ['ID'],
'filter' => ['=ID' => $value],
'limit' => 1
])->fetch();
return $arValidate['ID'] ? true : false;
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.