'1', 'radio_stream_url' => 'https://stream.radioking.com/radio/83232/radio.mp3', 'radio_style' => 'dark', 'radio_auto_play' => '0', // Points System Settings 'points_enabled' => '1', 'points_per_minute' => '2', 'max_points_per_day' => '100', 'points_for_request' => '5', 'points_for_vote' => '2', 'points_for_giveaway_win' => '50', 'points_for_contest_win' => '100', // Features Settings 'radio_shouts_enabled' => '1', 'radio_now_playing_enabled' => '1', 'radio_listeners_enabled' => '1', 'radio_show_current_dj' => '1', 'radio_widget_enabled' => '1', 'radio_widget_show_globally' => '1', 'radio_widget_position' => 'bottom-right', // DJ Settings 'radio_applications_enabled' => '1', 'radio_auto_dj_detection' => '1', // Monitoring Settings 'radio_monitoring_enabled' => '1', 'radio_monitoring_timeout' => '5', // Stream Settings 'radio_stream_fallback_url' => '', 'radio_stream_backup_enabled' => '0', // Display Settings 'radio_show_song_history' => '1', 'radio_show_schedule_preview' => '1', 'radio_max_history_items' => '10', // Social Settings 'radio_social_links_enabled' => '1', 'radio_facebook_url' => '', 'radio_twitter_url' => '', 'radio_discord_url' => '', 'radio_instagram_url' => '', 'radio_youtube_url' => '', 'radio_twitch_url' => '', // Moderation Settings 'radio_word_filter_enabled' => '1', 'radio_max_shout_length' => '280', 'radio_shout_cooldown' => '30', // Contest Settings 'radio_contests_enabled' => '1', 'radio_giveaways_enabled' => '1', 'radio_auto_contest_creation' => '0', ]; // Update all settings foreach ($settings as $key => $value) { WebsiteSetting::updateOrCreate( ['key' => $key], ['value' => $value, 'comment' => $this->getSettingComment($key)], ); } // Create default radio ranks if they don't exist $this->createDefaultRanks(); // Clear caches Artisan::call('config:clear'); Artisan::call('cache:clear'); return redirect()->route('admin.radio.setup') ->with('success', __('radio.setup.success_body')); } catch (\Exception $e) { return redirect()->route('admin.radio.setup') ->with('error', __('radio.setup.error_body', ['message' => $e->getMessage()])); } } public function doSetup(Request $request): RedirectResponse { return $this->setup($request); } public function reset(): RedirectResponse { try { WebsiteSetting::where('key', 'like', 'radio_%')->delete(); WebsiteSetting::where('key', 'like', 'points_%')->delete(); Artisan::call('config:clear'); Artisan::call('cache:clear'); return redirect()->route('admin.radio.setup') ->with('success', 'Radio instellingen zijn gereset.'); } catch (\Exception $e) { return redirect()->route('admin.radio.setup') ->with('error', 'Fout bij resetten: ' . $e->getMessage()); } } private function createDefaultRanks(): void { $ranks = [ ['name' => 'Trainee DJ', 'level' => 1, 'is_active' => true, 'description' => 'Beginnende DJ'], ['name' => 'Junior DJ', 'level' => 2, 'is_active' => true, 'description' => 'Ervaren DJ'], ['name' => 'Senior DJ', 'level' => 3, 'is_active' => true, 'description' => 'Professionele DJ'], ['name' => 'Head DJ', 'level' => 4, 'is_active' => true, 'description' => 'Hoofd DJ'], ['name' => 'Radio Manager', 'level' => 5, 'is_active' => true, 'description' => 'Radio Manager'], ]; foreach ($ranks as $rank) { RadioRank::updateOrCreate( ['name' => $rank['name']], $rank, ); } } private function getSettingComment(string $key): string { $comments = [ 'radio_enabled' => 'Enable radio system', 'radio_stream_url' => 'Main radio stream URL', 'radio_style' => 'Radio player theme style', 'radio_auto_play' => 'Auto-play radio on page load', 'points_enabled' => 'Enable points system', 'points_per_minute' => 'Points awarded per minute', 'max_points_per_day' => 'Maximum points per day', 'points_for_request' => 'Points for song request', 'points_for_vote' => 'Points for voting', 'points_for_giveaway_win' => 'Points for giveaway win', 'points_for_contest_win' => 'Points for contest win', 'radio_shouts_enabled' => 'Enable shouts system', 'radio_now_playing_enabled' => 'Show now playing info', 'radio_listeners_enabled' => 'Show listener count', 'radio_show_current_dj' => 'Show current DJ', 'radio_widget_enabled' => 'Enable radio widget', 'radio_widget_show_globally' => 'Show widget on all pages', 'radio_widget_position' => 'Widget position', 'radio_applications_enabled' => 'Enable DJ applications', 'radio_auto_dj_detection' => 'Auto-detect DJ from schedule', 'radio_monitoring_enabled' => 'Enable stream monitoring', 'radio_monitoring_timeout' => 'Stream check timeout', 'radio_stream_fallback_url' => 'Backup stream URL', 'radio_stream_backup_enabled' => 'Enable backup stream', 'radio_show_song_history' => 'Show recent songs', 'radio_show_schedule_preview' => 'Show today\'s schedule', 'radio_max_history_items' => 'Max history items to show', 'radio_social_links_enabled' => 'Enable social media links', 'radio_facebook_url' => 'Facebook page URL', 'radio_twitter_url' => 'Twitter profile URL', 'radio_discord_url' => 'Discord server URL', 'radio_instagram_url' => 'Instagram profile URL', 'radio_youtube_url' => 'YouTube channel URL', 'radio_twitch_url' => 'Twitch channel URL', 'radio_word_filter_enabled' => 'Enable word filter', 'radio_max_shout_length' => 'Maximum shout character length', 'radio_shout_cooldown' => 'Shout cooldown in seconds', 'radio_contests_enabled' => 'Enable contests', 'radio_giveaways_enabled' => 'Enable giveaways', 'radio_auto_contest_creation' => 'Auto-create contests', ]; return $comments[$key] ?? 'Radio setting'; } }