CodeIgniter Forums
Model with many allowedFields data - 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: Model with many allowedFields data (/showthread.php?tid=82635)



Model with many allowedFields data - pws - 08-02-2022

Hello,
I have an Model where i need to set the "allowedFields" with big array data (more than 50 fields)!
Is possible to define "allowedFields" where i not need to insert all fields!?
thanks


RE: Model with many allowedFields data - Ahmed Haroon - 08-02-2022

you mean, instead of marking allowedFields which are various you want NOTallowedFields which are fewer
yet i failed to find this type of thing. may be seniors will advise for proper solution, if it is a valid question.
happy learning CI4.


RE: Model with many allowedFields data - InsiteFX - 08-02-2022

Please read:
CodeIgniter User Guide - Using CodeIgniter’s Model - $allowedFields


RE: Model with many allowedFields data - pws - 08-03-2022

(08-02-2022, 10:46 PM)Ahmed Haroon Wrote: you mean, instead of marking allowedFields which are various you want NOTallowedFields which are fewer
yet i failed to find this type of thing. may be seniors will advise for proper solution, if it is a valid question.
happy learning CI4.

the solution is: $ClientiModel->protect(false)->insert(array("column"=>"val"));