nhance/app/Models/InsurerModel.php

64 lines
1.4 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",
];
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('id,name')
->where('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
}
// public function getdepositData($id)
// {
// // Fetch the insurer name based on the insurer ID
// $query = $this->db->table('cash_deposit')
// ->get()
// ->getResult();
// }
}