Hello, I have question about shield for codeigniter 4.
I have backend with form for edit and add new users. I use it like this:
PHP Code:
$this->validation->setRules([
'username' => 'is_unique[users.username,id,{user_id}]',
'email' => 'required|valid_email|unique_email[{user_id}]',
'password' => 'permit_empty|strong_password',
'password_confirm' => 'matches[password]',
]);
if (!$this->validation->withRequest($this->request)->run()) {
return redirect()->back()->withInput()->with('errors', $this->validation->getErrors());
}
But when I submit a form, I expect to be redirected back to the form and show errors from validation. But I got CodeIgniter\Shield\Exceptions\ValidationException.
I looked at sources and there is a trait for it - CheckQueryReturnTrait.
How to work with it, I just want to show validator errors like usual, but this throw exception and generate error.
Thank you.