O'Reilly logo

Programming with CodeIgniter MVC by Yehuda Zadik, Eli Orr

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Example 2 – a business logic example

In this example, we will demonstrate business logic. Ordering a product will trigger the model to update the product's quantity and check whether it's smaller than a certain amount.

This example will be constructed from the following controllers, model, and view:

  • application/controllers/order.php: This controller loads the model productmodel
  • $this->load->model(' productmodel'): This controller renders the view orderview, which displays all the products, and where each product has links to ordering a product
  • application/models/productmodel.php: This model contains functions, which retrieve products, updates its quantity, and checks its quantity
  • application/views/ orderview.php: The view displays all the products ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required