Admin can now control channel creation from the admin dashboard

This commit is contained in:
2026-05-16 03:43:25 +03:30
parent 34445f3032
commit f46f32aa4c
14 changed files with 639 additions and 95 deletions

View File

@@ -3,7 +3,9 @@
namespace Database\Seeders;
use App\Models\Category;
use App\Models\PlatformSetting;
use App\Models\User;
use App\Services\Streaming\StreamKeyManager;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
@@ -24,15 +26,35 @@ class DatabaseSeeder extends Seeder
['name' => $category['name']],
));
User::factory()->create([
'name' => 'Test User',
'email' => 'test@example.com',
PlatformSetting::current();
$admin = User::query()->firstOrNew(['email' => 'admin@nyone.net']);
$admin->forceFill([
'name' => 'Admin User',
'password' => 'password',
'email_verified_at' => now(),
'is_admin' => true,
'can_create_channel' => false,
])->save();
$official = User::query()->firstOrNew(['email' => 'chief@nyone.net']);
$official->forceFill([
'name' => 'Chief Nyone',
'password' => 'password',
'email_verified_at' => now(),
'is_admin' => false,
'can_create_channel' => true,
])->save();
$channel = $official->channel()->updateOrCreate([], [
'category_id' => Category::query()->where('slug', 'creative')->value('id'),
'slug' => 'nyone',
'display_name' => 'Nyone Official',
'description' => 'Official updates and live sessions from Nyone.',
]);
User::factory()->create([
'name' => 'Admin User',
'email' => 'admin@example.com',
'is_admin' => true,
]);
if (! $channel->streamKey()->exists()) {
app(StreamKeyManager::class)->rotate($channel);
}
}
}