Here is my code -
This gives me "Undefined property: App\Controllers\Home::$validation" error.
Code:
public function login()
{
if (! $this->validate([
'email' => 'required',
'password' => 'required'
])) {
echo Services::plates('login', [
'validation' => $this->validation
]);
} else {
//'title' => $this->request->getVar('title'),
}
}
However, I can fix this error using this b
Code:
$validation = \Config\Services::validation();
but I think as per documentation I should be able to pass validation object as above.
Another issue is in the view
Code:
<?= $validation->listErrors() ?>
It just shows me error messages for the given rules above without even submitting the form along with the name of the validation view file name.
Code:
1 ROOTPATH/system/Validation/Views/list.php
The email field is required.
The password field is required.
What am I doing wrong?