53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class InsurerModel extends Model
|
|
{
|
|
protected $table = 'insurers';
|
|
protected $primaryKey = 'id';
|
|
protected $allowedFields = [
|
|
"id",
|
|
"type",
|
|
"category",
|
|
"name",
|
|
"short_name",
|
|
"insurer_logo",
|
|
"created_by",
|
|
"updated_by",
|
|
"is_active",
|
|
"addition_add_day"
|
|
];
|
|
|
|
|
|
|
|
public function getCreatedByUserName()
|
|
{
|
|
|
|
return $this->db->table('insurers')
|
|
->select('insurers.*')
|
|
// ->select('user_profiles.first_name as user_name')
|
|
// ->join('user_profiles', 'user_profiles.id = clients.created_by')
|
|
->get()
|
|
->getResult();
|
|
}
|
|
public function getInsurerName($insurerId)
|
|
{
|
|
// Fetch the insurer name based on the insurer ID
|
|
$query = $this->select('insurers.id,insurers.name, cd_master.cd_ac_no')
|
|
->join('cd_master', 'cd_master.insurer_id = insurers.id')
|
|
->where('insurers.id', $insurerId)
|
|
->get();
|
|
|
|
if ($query->resultID->num_rows > 0) {
|
|
$result = $query->getRow();
|
|
return $result;
|
|
}
|
|
|
|
return null; // or handle accordingly if the insurer is not found
|
|
}
|
|
}
|
|
|
|
|