CodeIgniter Forums
validationRules returns Internal Server Error in CI4 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: validationRules returns Internal Server Error in CI4 (/showthread.php?tid=76482)



validationRules returns Internal Server Error in CI4 - Anwar - 05-16-2020

Hello, 

Having a small problem. I'm trying to build an API and when I setup the "protected $validationRules" I get the following error: 
{
    "status"500,
    "error"500,
    "messages": {
        "error""Internal Server Error"
    }
}


The code is: 

PHP Code:
protected $validationRules = [
        'email' => 'required|valid_email',
        'first_name' => 'required'
    ]; 

In postman I'm using an incorect email format. Same thing happens also if I don't put "first_name". 

So my issue it's not that I'm getting an error, that's what I'm looking to get ... but I'm looking to get "Invalid Email address" ... not "Internal Server Error" 

If anyone can help ... would be much appreciated. 


RE: validationRules returns Internal Server Error in CI4 - Anwar - 05-16-2020

Solved it ... obvious my mistake I was showing the error from $this instead of $model->errors()