Server IP : 164.52.202.56 / Your IP : 216.73.216.208 Web Server : Apache System : Linux e2e-70-56.ssdcloudindia.net 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Tue Nov 5 04:50:16 EST 2024 x86_64 User : rubyaromatics ( 1052) PHP Version : 7.2.34 Directory (0755) : /home/rubyaromatics/public_html/crm/application/models/ |
[ Home ] | [ Terminal ] | [ Upload File ] |
---|
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Company_setting_model extends CI_Model { public function getCountry(){ return $this->db->get('countries')->result(); } public function getState($id = null){ if($id == null){ $setting = $this->getData(); if($setting != null){ $id = $setting[0]->country_id; } } return $this->db->select('s.*') ->from('states s') ->join('countries c','c.id = s.country_id') ->where('s.country_id',$id) ->get() ->result(); } public function getCity($id = null){ if($id == null){ $setting = $this->getData(); if($setting != null){ $id = $setting[0]->state_id; } } return $this->db->select('c.*') ->from('cities c') ->join('states s','s.id = c.state_id') ->where('c.state_id',$id) ->get() ->result(); } public function getCurrency(){ return $this->db->get('currency')->result(); } public function getData(){ return $this->db->get('company_settings')->result(); } public function add($data){ $d = $this->db->get('company_settings')->result(); if($d != null){ return $this->db->update('company_settings',$data); } else{ return $this->db->insert('company_settings',$data); } } } ?>