Hey guys!!!
Continuing with the series on the CodeIgniter 4 framework, in today’s video I start the construction of the “Products” CRUD (which is a table that receives a list of the “Categories” table, using the foreign key “category_id”).
In this first part, I create the “ProductModel” and the controller “Products”. In addition, I also create the view “products_form” and in it I assemble the form for product registration.
As “product” is related to “category”, I also show how to display a “combo” of categories (data from the database) on the form. To assemble this combo, I use the “form_dropdown” function of the “form” helper (See more about this helper at: https://codeigniter4.github.io/userguide/helpers/form_helper.html ). With this function, it is possible to pass an array with the “id” and the “categoryname” and it already returns all the code to display the combo (“select” element of HTML) on the form.
The video is available at: https://www.youtube.com/watch?v=6vLO19QR54k&utm_source=rafaelwendel
Hope you like it!