I have a forder libararys in forder app. I have a file Myvalidate.php in forder librarys.
use Phalcon\Validation;
use Phalcon\Validation\Validator\Email;
use Phalcon\Validation\Validator\PresenceOf;
class Myvalidate extends Validation
{
public function initialize()
{
$this->add(
'username',
new PresenceOf(
array(
'message' => 'The user name is required'
)
)
);
$this->add(
'email',
new PresenceOf(
array(
'message' => 'The e-mail is required'
)
)
);
$this->add(
'email',
new Email(
array(
'message' => 'The e-mail is not valid'
)
)
);
$this->add(
'password',
new Email(
array(
'message' => 'The password is required'
)
)
);
}
}
```php
and file index.php in public/index.php
```php
$di->set('myvalidation', function () {
require __DIR__.'/../app/librarys/Myvalidation.php';
return $mycheck;
});
and in UserController I use $validation = $di->get("mycheck"); but get error service "mycheck" not found in service container. Please help me..