CodeIgniter Forums
Purpose of the model - less then in CI3? - 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: Purpose of the model - less then in CI3? (/showthread.php?tid=87907)



Purpose of the model - less then in CI3? - JanFromHamburg - 06-17-2023

Sorry if this is a stupid question, but do we generally do less stuff in the model now compared to CI3?
For example would I do the sanitazion of  "Post data" in the controller now and not in the model?
PHP Code:
$data['fieldname'] = $this->request->getVar('fieldname'FILTER_SANITIZE_STRING);
$model->insert($data); 



RE: Purpose of the model - less then in CI3? - kenjis - 06-17-2023

Why do you need to do the sanitization of "Post data" in the model?


RE: Purpose of the model - less then in CI3? - JanFromHamburg - 06-17-2023

(06-17-2023, 01:55 AM)kenjis Wrote: Why do you need to do the sanitization of  "Post data" in the model?
Well,.. I don't have to, but I used to do all the data modelling in the Model with CI3. 
So, I understand your feedback as a confirmation to do that in the controller. Thanks!