[CodeIgniter 4 video lesson] – Models – CRUD with relationship (Insert) – part 1

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!

He has a degree in Information Systems, a postgraduate degree in Database Systems and a master's degree in Education with a focus on Sociocommunity Technologies. He works as a teacher of technical and technological education at the Federal Institute of Education, Science and Technology of São Paulo, teaching subjects in the areas of programming, database, project development and software engineering.

Posts relacionados

Leave a Reply

Your email address will not be published. Required fields are marked *