You've already forked Atomcms-edit
4094f0fb14
HIGH: - Add missing import RadioSongRequestFormRequest (fixes crash on POST) - Add Purify XSS sanitization for article full_story - Fix duplicate radio API routes (/api/radio vs /api/radio/v2) - Add try-catch guards in InstallationController for missing records MEDIUM: - Fix N+1: eager load comments.user in ArticleController::show() - Fix GuestbookController authorization logic - Remove dead doSetup() method and duplicate route - Extract shared HasRadioDefaults trait (remove code duplication) - Use named routes in ForceStaffTwoFactorMiddleware - Fix WebsiteHelpCenterTicket::isOpen() (no permission leak) - Enable on WebsiteHelpCenterTicket (matches schema) - Replace WebsiteTeam::all()->pluck() with direct pluck() - Replace CatalogPage::all()->pluck() with direct pluck() - Replace WebsiteBadge::all() with direct pluck() - Add throttle middleware to guestbook store, logo-generator, radio embed LOW: - Remove unused imports - Remove dead /inertia-test route - Consolidate cache keys in RadioController
38 lines
1.2 KiB
PHP
38 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Concerns;
|
|
|
|
use App\Models\Miscellaneous\WebsiteSetting;
|
|
use App\Models\RadioRank;
|
|
|
|
trait HasRadioDefaults
|
|
{
|
|
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 saveRadioSettings(array $settings): void
|
|
{
|
|
foreach ($settings as $key => $value) {
|
|
WebsiteSetting::updateOrCreate(
|
|
['key' => $key],
|
|
['value' => (string) $value, 'comment' => 'Radio setting'],
|
|
);
|
|
}
|
|
}
|
|
}
|