needsOnboarding()) { $systemStatus = resolve(SystemStatusService::class)->getSystemStatus(); $statsService = resolve(DashboardStatsService::class); $period = $request->get('period', 'today'); $stats = $statsService->getStats($period); $systemStats = $statsService->getSystemStats(); $availablePeriods = $statsService->getAvailablePeriods(); return view('pages.dashboard', compact( 'systemStatus', 'stats', 'systemStats', 'availablePeriods', 'period' )); } return view('onboarding.welcome'); } public function platform(): View|RedirectResponse { if (!$this->needsOnboarding()) { return redirect()->route('feeds.index'); } return view('onboarding.platform'); } public function feed(): View|RedirectResponse { if (!$this->needsOnboarding()) { return redirect()->route('feeds.index'); } if (!$this->hasPlatformAccount()) { return redirect()->route('onboarding.platform'); } return view('onboarding.feed'); } public function channel(): View|RedirectResponse { if (!$this->needsOnboarding()) { return redirect()->route('feeds.index'); } if (!$this->hasPlatformAccount()) { return redirect()->route('onboarding.platform'); } if (!$this->hasFeed()) { return redirect()->route('onboarding.feed'); } return view('onboarding.channel'); } public function complete(): View|RedirectResponse { if (!$this->needsOnboarding()) { return redirect()->route('feeds.index'); } if (!$this->hasPlatformAccount() || !$this->hasFeed() || !$this->hasChannel()) { return redirect()->route('onboarding.index'); } $systemStatus = resolve(SystemStatusService::class)->getSystemStatus(); return view('onboarding.complete', compact('systemStatus')); } private function needsOnboarding(): bool { return !$this->hasPlatformAccount() || !$this->hasFeed() || !$this->hasChannel(); } private function hasPlatformAccount(): bool { return PlatformAccount::where('is_active', true)->exists(); } private function hasFeed(): bool { return Feed::where('is_active', true)->exists(); } private function hasChannel(): bool { return PlatformChannel::where('is_active', true)->exists(); } }