The roadmap begins with creating a model. Then, create a controller and use the model you created. Finally, give a face to your application by creating a view. Use the model to get data and pass it on to the view.
Creating a new model is extremely easy. It is no different to creating a simple PHP class in PhpStorm. To create a new model, you need to create a new PHP class inside <project-root>/app/models
. Your model will look like the following code:
namespace app\models; class Cooking { /** * Get the ingredients that will be added to your dish * @return array Containing the list of ingredients */ public function getIngredients(){ $ingredients = array('salt','cheese',''); $ingredientCount = 0; try { while ($ingredientCount < count($ingredients)) { if ($ingredients[$ingredientCount] == '') { throw new \ErrorException("\nYou have run out of capsicum."); } $ingredientCount...