There is only one model in this project—signup_model.php
that contains functions that are specific to adding a subscriber to the database, amending their settings and processing the removal of a subscriber should they unsubscribe.
This is our one and only model for this project. Let's briefly go over each function in it to give us a general idea of what it does, and then we will go into more details of the code.
There are four main functions in this model, which are as follows:
add()
: This accepts one argument: the$data
array sent by thesignup
controller'sindex()
function when a user successfully submits the form inviews/signup/signup.php
. Theadd()
function takes the array and using the$this->db->insert()
CodeIgniter Active Record function, it inserts the user's signup data in thesignups
table.edit()
: This accepts one argument: the$data
array sent by thesignup
controller'ssettings()
function. This function is called only if the user is editing their settings...