<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Start_claim_model extends Ci_Model
{

    public function __construct()
    {
        parent::__construct();
    }
    
    public function add_claim($data) {
      extract($data);
      $user_id = $this->session->userdata('user_id');
      $add_claim = $this->db->insert('claims', [
        'refno' => $refno,
        'name' => $name,
        'date_added' => date('Y-m-d H:m:s'),
        'ct_id' => $ct_id,
        'admin_id' => $admin_id,
        'icam' => $user_id,
        'status' => 0,
      ]);
      $add_claim = $this->db->affected_rows() > 0;
      
      if($docus){
        $add_docus = $this->db->insert_batch('claim_docus', $docus);
        return ['add_claim' => $add_claim, 'add_docus' => $add_docus];
      }else{
        return ['add_claim' => $add_claim];
      }
      
    }
}
