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

class Model_professional_membership_attachment extends CI_Model {
	function __construct() {
		parent::__construct();
    }

    public function fetchAttachment($staff_id = null, $mask_id = null)
    {
    	$this->db->select('*');
    	if($staff_id) $this->db->where('user_id',$staff_id);
        if($mask_id) $this->db->where('mask_id',$mask_id);
    	$this->db->where('is_delete',0);
    	$query = $this->db->get('user__profesional_membership_attachment');

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

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

    public function editAttachment($input, $id = null, $membership_id = null)
    {
        if($membership_id) $this->db->where('professional_membership_id',$membership_id);
        if($id) $this->db->where('id',$id);

        $this->db->update('user__profesional_membership_attachment',$input);
    }
}
?>