FIX_DUPLICAT_ENTRY

This commit is contained in:
VENKATESHWARAN 2026-08-04 18:05:16 +05:30
parent 107966a73d
commit b36a648995

View File

@ -613,8 +613,13 @@ class AgentController extends ResourceController
try{
$data = $this->request->getPost();
//duplicate check
$duplicateData = $this->AgentIncentiveFileModel->where('agent_id',$data['agent_id'])->where('incentive_month',$data['incentive_month'])->where('file_type','incentive')->first();
//duplicate check (ignore soft-deleted rows)
$duplicateData = $this->AgentIncentiveFileModel
->where('agent_id', $data['agent_id'])
->where('incentive_month', $data['incentive_month'])
->where('file_type', 'incentive')
->where('is_active', 1)
->first();
if(!empty($duplicateData)){
return $this->respond(['status' => 'failed', 'code' => 200, 'data' => 'Duplicate Entry.'], 200);
}