@php $catalogFeatures = config('feature_catalog.features', []); $catalogCategories = config('feature_catalog.categories', []); $grouped = []; foreach ($catalogFeatures as $fk => $fm) { $cat = $fm['category'] ?? 'other'; $grouped[$cat]['label'] = $catalogCategories[$cat]['label'] ?? ucfirst($cat); $grouped[$cat]['features'][$fk] = $fm['label'] ?? ucwords(str_replace('_', ' ', $fk)); } $planLimits = [ 'daily_transaction_limit' => 'Daily Transaction Limit', 'monthly_transaction_limit' => 'Monthly Transaction Limit', 'monthly_withdraw_limit' => 'Monthly Withdrawal Limit', 'monthly_send_limit' => 'Monthly Send Limit', 'virtual_card_limit' => 'Virtual Card Limit', 'p2p_ad_limit' => 'P2P Ad Limit', 'support_priority' => 'Support Priority', 'api_access' => 'API Access', ]; $currentKey = old('features.'.$i.'.feature_key', $feature['feature_key'] ?? ''); $currentLabel = old('features.'.$i.'.feature_label', $feature['feature_label'] ?? ''); $currentType = old('features.'.$i.'.feature_type', $feature['feature_type'] ?? 'limit'); $currentValue = old('features.'.$i.'.feature_value', $feature['feature_value'] ?? ''); $isToggle = $currentType === 'toggle'; $isEnabled = in_array(strtolower((string) $currentValue), ['enabled', '1', 'true', 'yes', 'on']); $allKnownKeys = array_merge(array_keys($catalogFeatures), array_keys($planLimits)); @endphp