BBnepal-Accounts/application/models/Inventory_model.php

34 lines
808 B
PHP
Raw Normal View History

2024-07-10 12:43:19 +00:00
<?php
defined('BASEPATH') or exit('No direct script access allowed');
use Nilambar\NepaliDate\NepaliDate;
require_once 'vendor/autoload.php';
class Inventory_model extends CI_Model
{
private $nepaliDateObject;
private $nepali_current_date;
public function __construct()
{
$this->load->database();
$this->load->helper('common_helper');
$this->nepaliDateObject = new NepaliDate();
$this->nepali_current_date = cuurentNepaliDate($this->nepaliDateObject);
}
public function get_unique_name($field_name, $field_value, $table_name)
{
$sql_query = "select * from " . $table_name . " WHERE " . $field_name . " = '" . $field_value . "'";
$query = $this->db->query($sql_query);
$results = $query->result_array();
if (empty($results)) {
return true;
} else {
return false;
}
}
}