46 lines
953 B
PHP
46 lines
953 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class InsuranceModel extends Model
|
|
{
|
|
protected $table = 'c_insurance';
|
|
protected $primaryKey = 'insurance_id';
|
|
|
|
protected $allowedFields = [
|
|
'plan_id',
|
|
'start_date',
|
|
'end_date',
|
|
'type_of_insurance',
|
|
'comments',
|
|
'nominee_name',
|
|
'nominee_dob',
|
|
'nominee_relationship',
|
|
'created_by',
|
|
'updated_by',
|
|
'is_active'
|
|
];
|
|
|
|
protected $useTimestamps = false;
|
|
protected $createdField = 'created_on';
|
|
protected $updatedField = 'updated_on';
|
|
|
|
/**
|
|
* Get active insurance records
|
|
*/
|
|
public function getActiveInsurances()
|
|
{
|
|
return $this->where('is_active', 1)->findAll();
|
|
}
|
|
|
|
/**
|
|
* Get insurance records for a specific plan
|
|
*/
|
|
public function getInsurancesByPlan($planId)
|
|
{
|
|
return $this->where('plan_id', $planId)->findAll();
|
|
}
|
|
}
|