Now that we have made all the amendments to configuration files, created the database, and created all the files necessary for the app to work (controllers, models, views, and so on) let's run through a few scenarios briefly, just to make sure we know how the app functions.
Let's consider an example where Lucy visits the URL Shortener app and the create
controller is called by CodeIgniter, displaying the create/create.php
view file. The following is the sequence of events:
Lucy enters a URL in the text input and clicks on Shorten Now.
Upon submitting the form, the controller validates the URL. The URL is successfully validated and the validation returns no errors.
The URL entered by Lucy is then sent to the
save_url()
function ofUrls_model
that creates a unique code. Thesave_url()
function uses the PHP constructdo while
and an Active Record database query to create a unique code that doesn't already exist in the database.Once a code has been...