diff --git a/app/Http/Controllers/BillplzTransactionReviewController.php b/app/Http/Controllers/BillplzTransactionReviewController.php index 5160b32..8bc8979 100644 --- a/app/Http/Controllers/BillplzTransactionReviewController.php +++ b/app/Http/Controllers/BillplzTransactionReviewController.php @@ -18,12 +18,13 @@ class BillplzTransactionReviewController extends Controller 'KOPKB', ]; - $billplzTransactionReview = array_map(function($company_code) use($date){ + $billplzTransactionReview = array_reduce($companyMapping, function($carry, $company_code) use($date){ $billplzService = new BillplzService($company_code); - return $billplzService->getBillplzTransactionReview($date)->toArray(); - }, $companyMapping); + $carry[$company_code] = $billplzService->getBillplzTransactionReview($date)->toArray(); + return $carry; + }, []); - return response()->json(array_merge(...$billplzTransactionReview), 200); + return response()->json($billplzTransactionReview, 200); } public function show(Request $request)