I using Codeigniter 4
I already add in Routes.php
$routes->get('/register', 'Auth::register');
and this is Auth.php
public function register()
{
$data['page_title'] = "Register";
if ($this->request->getMethod() === 'post') {
$email = $this->request->getPost('email');
if ($this->validate([
'email' => 'required',
'pwd' => 'required',
'repwd' => 'required|matches[pwd]'
])) {
$pwd = $this->request->getPost('pwd');
$repwd = $this->request->getPost('repwd');
$ip = $this->request->getIPAddress();
return redirect()->to('/');
}
$data['email'] = $email;
$this->session->setFlashdata('isFormError', true);
}
return view('auth/register', $data);
}
for view is just simple html form with method post. after form submit, I got error :
404 - File Not Found
Controller or its method is not found: \App\Controllers\Register::index
I using http://localhost:8080/register
and also redirected to http://localhost:8080/register
but it load \App\Controllers\Register::index
not \App\Controllers\Auth::register
how to solve this? may be I miss something or is this CI4 bugs?