1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27:
<?php
class Rewards extends CI_Model
{
/*
Inserts or updates a rewards
*/
public function save(&$rewards_data, $id = -1)
{
if($id == -1 || !$this->exists($id))
{
if($this->db->insert('sales_reward_points', $rewards_data))
{
$rewards_data['id'] = $this->db->insert_id();
return TRUE;
}
return FALSE;
}
$this->db->where('id', $id);
return $this->db->update('sales_reward_points', $rewards_data);
}
}
?>