Example #1
0
 public function create()
 {
     $region = new Region();
     if ($this->input->post("name")) {
         $region->populate($this->input->post());
         if ($region->save()) {
             Notification::set(Regions::SUCCESS, "The region has been added");
             redirect("/regions/");
         }
     }
     $this->data["region"] = $region;
     $this->load->view("regions/create.tpl", $this->data);
 }
Example #2
0
 /**
  * Load all regions
  *
  * @access public
  * @return Array
  */
 public function load()
 {
     $this->db->select("*");
     $this->db->from(self::TABLE);
     $get = $this->db->get()->result_array();
     $result = [];
     if (!is_null($get)) {
         foreach ($get as $row) {
             $object = new Region();
             $result[] = $object->populate($row);
         }
     }
     return $result;
 }