public function haveSufficientItem(array $pemakaianRecords) { $atkService = new AtkService(); foreach ($pemakaianRecords as $pemakaianRecord) { $atk = Atk::find($pemakaianRecord['atk_id']); $itemAvailable = $atkService->getItemCount($atk); if ($itemAvailable < $pemakaianRecord['jumlah']) { return false; } } return true; }