| 
				Server : Apache System : Linux server.mata-lashes.com 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 User : matalashes ( 1004) PHP Version : 8.1.29 Disable Function : NONE Directory : /home/matalashes/public_html/kite.mata-lashes.com/app.bak/Models/  | 
Upload File :  | 
<?php
namespace App\Models;
use CodeIgniter\Model;
class PsStoreMain extends Model
{
    protected $DBGroup          = 'default';
    protected $table            = 'ps_store_main';
    protected $primaryKey       = 'ps_store_id';
    protected $useAutoIncrement = true;
    protected $insertID         = 0;
    protected $returnType       = 'object';
    protected $useSoftDeletes   = true;
    protected $protectFields    = true;
    protected $allowedFields    = ['ps_sa_id','sm_logo','sm_name','sm_slug','sm_phone','sm_email','sm_website','sm_address','sm_province','sm_city','sm_district','sm_postal_code','sm_status','sm_open_time','sm_closed_time','deleted_at'];
    // Dates
    protected $useTimestamps = true;
    protected $dateFormat    = 'datetime';
    protected $createdField  = 'created_at';
    protected $updatedField  = 'updated_at';
    protected $deletedField  = 'deleted_at';
    // Validation
    protected $validationRules      = [];
    protected $validationMessages   = [];
    protected $skipValidation       = false;
    protected $cleanValidationRules = true;
    // Callbacks
    protected $allowCallbacks = true;
    protected $beforeInsert   = [];
    protected $afterInsert    = [];
    protected $beforeUpdate   = [];
    protected $afterUpdate    = [];
    protected $beforeFind     = [];
    protected $afterFind      = [];
    protected $beforeDelete   = [];
    protected $afterDelete    = [];
    
    public function fieldExist($field_name)
    {
        $db = \Config\Database::connect();
        return $db->fieldExists($field_name, 'ps_store_main');
    } 
    public static function getByStoreId($where)
    {
        $db = \Config\Database::connect();
        $builder = $db->table('ps_store_main');
        $builder->select();
        $builder->join('ps_store_account', 'ps_store_account.ps_sa_id=ps_store_main.ps_sa_id');
        $builder->where($where);
        return $builder->get()->getFirstRow();
    }
}