| 
				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/simulasikite.mata-lashes.com/app.bak/Models/  | 
Upload File :  | 
<?php
namespace App\Models;
use CodeIgniter\Model;
use Config\Database;
class PsAdmListmenuChild extends Model
{
    protected $DBGroup          = 'default';
    protected $table            = 'ps_adm_listmenu_child';
    protected $primaryKey       = 'ps_alc_id';
    protected $useAutoIncrement = true;
    protected $insertID         = 0;
    protected $returnType       = 'object';
    protected $useSoftDeletes   = true;
    protected $protectFields    = true;
    protected $allowedFields    = [];
    // 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 static function get_by_kode($kode)
    {
        $db = Database::connect();
        $builder = $db->table('ps_adm_listmenu_child');
        $builder->select();
        $builder->where('alc_kode', $kode);
        $builder->where('deleted_at', null);
        $builder->orderBy('alc_order');
        return $builder->get()->getFirstRow();
    }
    public static function get_by_alc_kode($where)
    {
        $db = Database::connect();
        $builder = $db->table('ps_adm_listmenu_child');
        $builder->select();
        $builder->join('ps_adm_listmenu_parent', 'ps_adm_listmenu_parent.ps_alp_id=ps_adm_listmenu_child.ps_alp_id');
        $builder->where($where);
        $builder->where('ps_adm_listmenu_child.deleted_at', null);
        $builder->orderBy('alc_order');
        return $builder->get()->getResult();
    }
    public static function get_by_parent($id)
    {
        $model = new PsAdmListmenuChild();
        $model->where('ps_alp_id', $id);
        $model->where('deleted_at', null);
        $model->orderBy('alc_order');
        return $model->get()->getResult();
    }
}