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.



11.6k

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

As i wrote - just use Phalcon\Validation.



11.6k

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() ?



11.6k

ok, i try it

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