HEX
Server: Apache
System: Linux p3plzcpnl506847.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: slfopp7cb1df (5698090)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //home/slfopp7cb1df/public_html/pm/app/Models/Company_model.php
<?php

namespace App\Models;

class Company_model extends Crud_model {

    protected $table = null;

    function __construct() {
        $this->table = 'company';
        parent::__construct($this->table);
    }

    function get_details($options = array()) {
        $company_table = $this->db->prefixTable('company');
        
        $where = "";
        $id = get_array_value($options, "id");
        if ($id) {
            $where = " AND $company_table.id=$id";
        }
        
        $is_default = get_array_value($options, "is_default");
        if ($is_default) {
            $where = " AND $company_table.is_default=1";
        }

        $sql = "SELECT $company_table.*
        FROM $company_table
        WHERE $company_table.deleted=0 $where";
        return $this->db->query($sql);
    }

    function remove_other_default_company($except_id) {
        $company_table = $this->db->prefixTable('company');

        $sql = "UPDATE $company_table SET $company_table.is_default=0 WHERE $company_table.id!=$except_id AND $company_table.is_default=1; ";
        $this->db->query($sql);
    }

}