
<?php
    $cfg = $widget->content_with_defaults;
    $stats = [];

    $cacheKey = 'homepage_stats_widget';
    $cachedStats = \Illuminate\Support\Facades\Cache::get($cacheKey);
    
    if ($cachedStats) {
        $stats = $cachedStats;
    } else {
        if ($cfg['show_topics'] ?? true) {
            $stats['topics'] = ['icon' => '💬', 'label' => 'Forum Konusu', 'value' => \App\Models\ForumTopic::count()];
        }
        if ($cfg['show_posts'] ?? true) {
            $stats['posts'] = ['icon' => '📰', 'label' => 'Blog Yazısı', 'value' => \App\Models\BlogPost::published()->count()];
        }
        if ($cfg['show_users'] ?? true) {
            $stats['users'] = ['icon' => '👥', 'label' => 'Aktif Üye', 'value' => \App\Models\User::count()];
        }
        \Illuminate\Support\Facades\Cache::put($cacheKey, $stats, 300);
    }
?>

<?php if(!empty($stats)): ?>
<div style="background: #f8fafc; padding: 50px 24px;">
    <div style="max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px;">
        <?php $__currentLoopData = $stats; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $stat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div style="background: #ffffff; border-radius: 12px; padding: 24px; border: 1px solid #e5e7eb;
                    box-shadow: 0 2px 8px rgba(0,0,0,0.06); text-align: center;">
            <div style="font-size: 32px; margin-bottom: 8px;"><?php echo e($stat['icon']); ?></div>
            <div style="font-size: 32px; font-weight: 900; background: linear-gradient(135deg, #3b82f6, #8b5cf6);
                        -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 4px;">
                <?php echo e(number_format($stat['value'])); ?>

            </div>
            <div style="font-size: 13px; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;">
                <?php echo e($stat['label']); ?>

            </div>
        </div>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </div>
</div>
<?php endif; ?>
<?php /**PATH C:\xampp\htdocs\askeribilgiler\resources\views\widgets\stats.blade.php ENDPATH**/ ?>