diff --git a/app/Http/Controllers/CallCenterController.php b/app/Http/Controllers/CallCenterController.php index 3a75943..db8048c 100644 --- a/app/Http/Controllers/CallCenterController.php +++ b/app/Http/Controllers/CallCenterController.php @@ -1332,25 +1332,27 @@ class CallCenterController extends Controller $notisjbgbycaw = NotisPeringatan::on('mysql7') ->where('notisperingatan.notis_id',$notisid)->where('notisperingatan.kodcaw',$kodcaw) ->where('notisperingatan.peringatan',2) - ->distinct() - ->get(); + //->distinct() //asal + ->orderBy('nokp') + ->get(); //asal - $arraynorujukan = $notisjbgbycaw->pluck('norujukan')->toArray(); - $notisnokp = NotisPeringatan::on('mysql7')->whereIn('norujukan', $arraynorujukan) + $arraynorujukan = $notisjbgbycaw->pluck('norujukan')->toArray(); //asal + + $notisnokp = NotisPeringatan::whereIn('norujukan', $arraynorujukan) ->where('notisperingatan.peringatan',2) ->select('nokp') ->groupBy('nokp') - ->get(); + ->get(); // asal - foreach($notisnokp as $index1=>$cal){ - $customer = Customer::on('mysql7')->where('kpbaru','=',$cal['nokp']) + foreach($notisnokp as $index=>$cal){ //asal + //$customer = Customer::on('mysql7')->where('kpbaru','=',$cal['nokp']) //asal + $customer = Customer::where('kpbaru','=',$cal['nokp']) ->orWhere('kplama','=',$cal['nokp']) ->first(); - $listnotis = NotisPeringatan::on('mysql7')->whereIn('norujukan', $arraynorujukan) - // ->where('nokp','=',$cal['nokp']) - ->where('nokp', 'like', '%'.$cal['nokp'].'%') - ->where('notisperingatan.peringatan',2) + //$listnotis = NotisPeringatan::on('mysql7')->whereIn('norujukan', $arraynorujukan) //asal + $listnotis = NotisPeringatan::whereIn('norujukan', $arraynorujukan) + ->where('nokp','=',$cal['nokp']) ->get(); $listsag = Gadai::on($cawangan['mysql']) @@ -1375,9 +1377,9 @@ class CallCenterController extends Controller $listsag[$index2]['keuntungan'] = $response; } - $notisnokp[$index1]['info'] = $customer; - $notisnokp[$index1]['listsag'] = $listsag; - $notisnokp[$index1]['listnotis'] = $listnotis; + $notisnokp[$index]['info'] = $customer; + $notisnokp[$index]['listsag'] = $listsag; + $notisnokp[$index]['listnotis'] = $listnotis; }