tstat_be/app/Models/LevelModel.php

29 lines
881 B
PHP

<?php
namespace App\Models;
use CodeIgniter\Model;
class LevelModel extends Model
{
protected $table = 'm_level'; // Table name
protected $primaryKey = 'level_id'; // Primary key
// Fields that can be mass assigned
protected $allowedFields = [
'code','name','description','org_id','policy_id','policy_name','int_policy_id','int_policy_name','group_travel','created_on','created_by','updated_on','updated_by','is_active',
];
// Specify the return type of the results
protected $returnType = 'array';
// Enable timestamps (if you wish to handle created_at and updated_at automatically)
protected $useTimestamps = false; // Set true if using CI4 timestamp features
// Custom method example (e.g., fetching active levels)
public function getActiveLevels()
{
return $this->where('is_active', 1)->findAll();
}
}