fix issues lelong arrahnbid

This commit is contained in:
hafifierahman
2023-01-10 12:21:15 +08:00
parent 7cd266a417
commit b17f60a71c
4 changed files with 97 additions and 3 deletions
+21 -3
View File
@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\Models\LelongBid;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Http;
@@ -37,6 +38,16 @@ class InformationController extends Controller
$pembiayaansemasa = $CustomerInfo['gadai'];
}
if(isset($CustomerInfo['lelong'])){
if(sizeof($CustomerInfo['lelong']) > 0){
foreach($CustomerInfo['lelong'] as $index=>$lelong){
$array_lelong = LelongBid::select('fasa','t_lelong')->where([['norujukan',$lelong['norujukan']],['hargajual','>',0]])->first()->toArray();
$CustomerInfo['lelong'][$index] = collect($lelong)->merge($array_lelong)->toArray();
}
$pembiayaansemasa = collect($pembiayaansemasa)->merge($CustomerInfo['lelong']);
}
}
$pembiayaansemasa = $pembiayaansemasa->toArray();
return response()->json($pembiayaansemasa,200);
// return view('includes.information.pembiayaanaktif',compact('pembiayaansemasa'));
}
@@ -71,9 +82,15 @@ class InformationController extends Controller
$CustomerInfo = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/portal/customer/info',['ic' => $auth_user['icno']])->json();
$lelong = [];
if(isset($CustomerInfo['lelong']))
{
$lelong += $CustomerInfo['lelong'];
if(isset($CustomerInfo['lelong'])){
if(sizeof($CustomerInfo['lelong']) > 0){
foreach($CustomerInfo['lelong'] as $index=>$lel){
$array_lelong = LelongBid::select('fasa','t_lelong')->where([['norujukan',$lel['norujukan']],['hargajual','>',0]])->first()->toArray();
$CustomerInfo['lelong'][$index] = collect($lel)->merge($array_lelong)->toArray();
}
$lelong = collect($lelong)->merge($CustomerInfo['lelong']);
}
}
@@ -88,3 +105,4 @@ class InformationController extends Controller
return view('auth.termasyarat', compact('termasyarat'));
}
}