In this class of the CodeIgniter 4 series , I continue the subject related to “ models ” and increase the CRUD that I started to develop in the previous video. I show you how to retrieve all data from a database table using a method of our “model” class. These fetched data are returned to a controller and later passed on to be displayed in a “ view ” (via an HTML table).
So, now the CRUD of our project already has the form for registering new records and has a “view” to display all the records that are registered in the table. To “link” the two pages I used the “url” helper (and also showed how to import a helper into a controller).
Continuing with the series on CodeIgniter 4 , in today’s class I show you how to create a MODEL in CI4 for a database table. This model requires a minimum of code, since CI4 already provides a generic class with the main methods for entering , editing , deleting and searching data in the bank.
In this video lesson in the CodeIgniter 4 series , I create a database, which will be the basis of our application and which will support the MODELS classes at CI4.
The database adopted for the classes is MySQL , as it is a very popular DBMS and widely used by PHP programmers, as well as by CI users.
In this class I show you how to create a VirtualHost in WAMP ( Apache ) and point this host to the root (“public” folder) of our project in CodeIgniter 4 . (WAMP was the tool of choice because it is the tool I am using in class. Below are links that show how to create virtual hosts in the most popular tools;).
In addition to creating the host, I also show how to enable “rewrite_mod” in Apache, to enable the use of URL rewriting (Friendly URLs). That way, we can remove the “index.php” from the URL, for example, making it more “lean”.
Continuing with the series of classes on CodeIgniter 4 , in today’s video I go deeper into the concept of Views and show you how to easily create a template structure within CI4.
With this structure, just create the template areas (header, menu, footer, etc.) in separate Views and then include them within the other Views . This feature makes development faster and more organized and avoids code rewriting.