tstat_be/app/Models/MiscellaneousModel.php

41 lines
856 B
PHP

<?php
namespace App\Models;
use CodeIgniter\Model;
class MiscellaneousModel extends Model
{
protected $table = 'c_miscellaneous';
protected $primaryKey = 'miscellaneous_id';
protected $allowedFields = [
'plan_id',
'special_request',
'comments',
'created_by',
'updated_by',
'is_active'
];
protected $useTimestamps = false;
protected $createdField = 'created_on';
protected $updatedField = 'updated_on';
/**
* Get active miscellaneous records
*/
public function getActiveMiscellaneous()
{
return $this->where('is_active', 1)->findAll();
}
/**
* Get miscellaneous records for a specific plan
*/
public function getMiscellaneousByPlan($planId)
{
return $this->where('plan_id', $planId)->findAll();
}
}