nhance/app/Models/TicketMasterModel.php
Srinivas-Saravanan 8a87addf4e BRANCH_MERGE_SRI
2025-01-28 10:19:13 +05:30

98 lines
2.9 KiB
PHP

<?php
namespace App\Models;
use CodeIgniter\Model;
class TicketMasterModel extends Model
{
protected $table = 'ticket_master';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
<<<<<<< HEAD
protected $allowedFields = ['id', 'ticket_type_id', 'claim_status_id', 'acm_id', 'insurer_id',
'tpa_id', 'client_id', 'priority', 'policy_no', 'emp_code', 'tpa_no', 'emp_name', 'insured_name',
'relationship', 'emp_mobile', 'emp_mail', 'mode_of_intimation', 'claim_type', 'hospital_name',
'doa', 'dod', 'claim_amount', 'pod_no', 'created_by', 'updated_by', 'created_at', 'updated_at',
'date_of_join', 'date_of_incep', 'dob', 'date_of_accident', 'date_of_death', 'date_of_intimat',
'si_amt','claim_number,is_active'
];
=======
protected $allowedFields = [
'id',
'ticket_type_id',
'claim_status_id',
'acm_id',
'insurer_id',
'tpa_id',
'client_id',
'priority',
'policy_no',
'emp_code',
'tpa_no',
'emp_name',
'insured_name',
'relationship',
'emp_mobile',
'emp_mail',
'mode_of_intimation',
'claim_type',
'hospital_name',
'doa',
'dod',
'claim_amount',
'pod_no',
'created_by',
'updated_by',
'created_at',
'updated_at',
'date_of_join',
'date_of_incep',
'dob',
'date_of_accident',
'date_of_death',
'date_of_intimat',
'si_amt',
'is_active',
'claim_number'
];
>>>>>>> 3a4f7b1e836fc71f477cb6ad32a635dcae0192d0
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = ["checkAndADDCreatedByValue"];
protected $afterInsert = [];
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
protected function checkAndADDCreatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['created_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['created_by'] = get_session_userid();
}
return $data;
}
protected function checkAndUpdateUpdatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['updated_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['updated_by'] = get_session_userid();
}
return $data;
}
}