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

class Benefit_model extends CI_Model {

    public function benefit_view()
    {
        return $this->db->select('*')
            ->from('benefit')
            ->order_by('benefit_id', 'desc')
            ->get()
            ->result();
    }

    public function benefit_create($data = array())
    {
        return $this->db->insert('benefit', $data);
    }

    public function update_benefit($data = array())
    {
        return $this->db->where('benefit_id',$data["benefit_id"])
            ->update("benefit", $data);


    }
    public function benefit_updateForm($id){
        $this->db->where('benefit_id',$id);
        $query = $this->db->get('benefit');
        return $query->row();
    }

    public function benefit_delete($id = null)
    {
        $this->db->where('benefit_id',$id)
            ->delete('benefit');

        if ($this->db->affected_rows()) {
            return true;
        } else {
            return false;
        }
    }

}
