<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Model_recurring_payment extends CI_Model {

	public function fetchPayment($staff_id = null, $latest = false, $profiling_id = null)
	{
		$this->db->select('a.*');

		if($staff_id) $this->db->where('a.user_id',$staff_id);
		if($profiling_id) $this->db->where('a.profiling_id',$profiling_id);
		
		$this->db->where('a.is_delete',0);

		$query = $this->db->get('user__recur_payment a');

		return ($query->num_rows() > 0)? $query->result() : null;
	}

	public function createPayment($input)
	{
		$this->db->insert('user__recur_payment',$input);
		return $this->db->insert_id();
	}

	public function editPayment($input,$id)
	{
		$this->db->set($input);
		$this->db->where('id',$id);
		$this->db->update('user__recur_payment');
	}
}
?>