Welcome Guest, Not a member yet? Register   Sign In
Own validation rules with CodeIgniter >4.5
#11

ozornick Wrote:I would like to remind you that some people don't use anything: neither groups nor classes. They create them in controllers  Smile
Yes and as I said, CodeIgniter gives you that freedom. This forum is for best practices and that's what the OP asked. What you consider a best practice may differ.

ozornick Wrote:You are wrong about $this‐>validator, the object will appear only after validation, so you can’t work with it before that.
You're absolutely right about that, the could should be:
PHP Code:
if($this->validateData($data'newsletter'))
 
$validatedData $this->validator->getValidated(); 
The controller does instantiate it automatically, but only after you use one of the validation methods.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB