Join Jon Peck for an in-depth discussion in this video Modeling a magazine, part of Up and Running with PHP CodeIgniter (2013).
Magazine back issues have a number of common properties.…For the purposes of this course, I'm going to limit the domain to two models.…One for the publication as a unifying record and the second for the issues themselves.…Each publication has a unique identifier, the publication id and a publication name.…Magazine back issues are a little bit more complex.…They have a unique identifier, the issue id, then the unifying record to the…publication, publication id. As an issue number, which is the number…given by the publisher and the date of publication, and finally the path to the…file containing the cover. Let's switch to the IDE and start the…models for the publication and issue. Models are stored in application models,…navigate there now. There's currently nothing in there, except…for the index place holder. I'm going to create a new file for the publication.…
Same as controller names, the file name will be all lower case.…Publication.php. In the empty file, let's start a new class.…The class name must be the same as the file name with the exception that it must…
Starting with the what and why of CodeIgniter, Jon introduces key concepts such as the MVC pattern and libraries by demonstrating how to create static pages, then storing and displaying magazine info in a database. Advanced topics like classes and helpers are explored to validate user input, upload files, and much more. By creating a complete system, you'll have the foundation to build your own applications with CodeIgniter.
- What is CodeIgniter?
- Creating a static page controller
- Generating output with a view
- What is a model?
- Saving data with Active Records
- Creating forms
- Validating user input
- Listing records in tables
- Uploading images
- Viewing and deleting records