1.0, 'curated' => 0.0, 'spotlight' => 0.0, ]); } // ─── Auto-disable logic ─────────────────────────────────────────────────── /** * Check whether upload volume or active-user count has crossed the * configured threshold for organic scale, and the system should self-disable. * Result is cached for 10 minutes to avoid constant DB polling. */ private static function shouldAutoDisable(): bool { return (bool) Cache::remember('egs.auto_disable_check', 600, function (): bool { $uploadsThreshold = (int) config('early_growth.auto_disable.uploads_per_day', 50); $usersThreshold = (int) config('early_growth.auto_disable.active_users', 500); // Average daily uploads over the last 7 days $recentUploads = Artwork::query() ->where('is_public', true) ->where('is_approved', true) ->whereNull('deleted_at') ->where('published_at', '>=', now()->subDays(7)) ->count(); $uploadsPerDay = $recentUploads / 7; if ($uploadsPerDay >= $uploadsThreshold) { return true; } // Active users: verified accounts who uploaded in last 30 days $activeCreators = Artwork::query() ->where('is_public', true) ->where('is_approved', true) ->where('published_at', '>=', now()->subDays(30)) ->distinct('user_id') ->count('user_id'); return $activeCreators >= $usersThreshold; }); } // ─── Status summary ────────────────────────────────────────────────────── /** * Return a summary array suitable for admin panels / logging. */ public static function status(): array { return [ 'enabled' => self::enabled(), 'mode' => self::mode(), 'adaptive_window' => self::adaptiveWindowEnabled(), 'grid_filler' => self::gridFillerEnabled(), 'spotlight' => self::spotlightEnabled(), 'activity_layer' => self::activityLayerEnabled(), ]; } }