We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How single validation field?

I need validate field before use model method in controller action

public function indexAction()
{
    $data = $this->request->getJsonRawBody();
    ...
}

how validate $data->login ?

Waht you mean validate ? just create Phalcon\Validation object and use it. It can be used without model/form.



25.0k

if i need in indexAction login required and in checkAction login not required How do it?

As i wrote - just use Phalcon\Validation.



25.0k

if i use Validation

class RestValidation extends Validation
{
    public function initialize()
    {
        $this->add('email', new Email(['...']));
    }
}

and set email required

email can be required for all

Then just add some method like $validation->addLoginValidator() ?



25.0k

ok, i try it

Then just add some method like $validation->addLoginValidator() ?