TenantAtlas/apps/platform/database/seeders/PlatformUserSeeder.php
Ahmed Darrazi 1123b122d9
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 7m13s
feat: cut over tenant core to managed environments
2026-05-07 08:35:42 +02:00

56 lines
1.8 KiB
PHP

<?php
namespace Database\Seeders;
use App\Models\PlatformUser;
use App\Models\ManagedEnvironment;
use App\Models\Workspace;
use App\Support\Auth\PlatformCapabilities;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
class PlatformUserSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$workspace = Workspace::query()->firstOrCreate(
['slug' => 'default'],
['name' => 'Default Workspace', 'slug' => 'default'],
);
ManagedEnvironment::query()->updateOrCreate(
['slug' => 'platform'],
[
'name' => 'Platform',
'display_name' => 'Platform',
'workspace_id' => (int) $workspace->getKey(),
],
);
PlatformUser::query()->updateOrCreate(
['email' => 'operator@tenantpilot.io'],
[
'name' => 'Platform Operator',
'password' => Hash::make('password'),
'capabilities' => [
PlatformCapabilities::ACCESS_SYSTEM_PANEL,
PlatformCapabilities::USE_BREAK_GLASS,
PlatformCapabilities::CONSOLE_VIEW,
PlatformCapabilities::DIRECTORY_VIEW,
PlatformCapabilities::SUPPORT_ACCESS_MANAGE,
PlatformCapabilities::OPERATIONS_VIEW,
PlatformCapabilities::OPERATIONS_MANAGE,
PlatformCapabilities::OPS_VIEW,
PlatformCapabilities::RUNBOOKS_VIEW,
PlatformCapabilities::RUNBOOKS_RUN,
PlatformCapabilities::OPS_CONTROLS_MANAGE,
],
'is_active' => true,
],
);
}
}