Files
crewli/api/database/seeders/DevSeeder.php
bert.hausmans c417a6647a feat(app): auth, orgs/events UI, router guards, and dev tooling
- Add Sanctum auth flow (store, composables, login, axios interceptors)
- Add dashboard, organisation list/detail, events CRUD dialogs
- Wire router guards, navigation, organisation switcher in layout
- Replace Vuexy @db types in NavSearchBar; add @iconify/types; themeConfig title typing
- Vuetify settings.scss + resolve configFile via fileURLToPath; drop dead path aliases
- Root index redirects to dashboard; fix events table route name
- API: DevSeeder + DatabaseSeeder updates; docs TEST_SCENARIO; corporate identity assets

Made-with: Cursor
2026-04-07 21:51:10 +02:00

81 lines
2.3 KiB
PHP

<?php
declare(strict_types=1);
namespace Database\Seeders;
use App\Models\Organisation;
use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
class DevSeeder extends Seeder
{
public function run(): void
{
$this->call(RoleSeeder::class);
// 1. Super Admin
$admin = User::firstOrCreate(
['email' => 'admin@crewli.test'],
[
'name' => 'Dev Admin',
'password' => Hash::make('password'),
],
);
$admin->assignRole('super_admin');
// Test organisation
$org = Organisation::firstOrCreate(
['slug' => 'test-festival-bv'],
[
'name' => 'Test Festival BV',
'billing_status' => 'active',
'settings' => [],
],
);
// 2. Org Admin
$orgAdmin = User::firstOrCreate(
['email' => 'orgadmin@crewli.test'],
[
'name' => 'Org Admin',
'password' => Hash::make('password'),
],
);
if (!$org->users()->where('user_id', $orgAdmin->id)->exists()) {
$org->users()->attach($orgAdmin, ['role' => 'org_admin']);
}
// Second test organisation (for testing the organisation switcher)
$org2 = Organisation::firstOrCreate(
['slug' => 'zomerfest-nederland'],
[
'name' => 'Zomerfest Nederland',
'billing_status' => 'trial',
'settings' => [],
],
);
// Attach admin and orgAdmin to second org too
if (!$org2->users()->where('user_id', $admin->id)->exists()) {
$org2->users()->attach($admin, ['role' => 'org_admin']);
}
if (!$org2->users()->where('user_id', $orgAdmin->id)->exists()) {
$org2->users()->attach($orgAdmin, ['role' => 'org_member']);
}
// 3. Org Member
$member = User::firstOrCreate(
['email' => 'crew@crewli.test'],
[
'name' => 'Crew Member',
'password' => Hash::make('password'),
],
);
if (!$org->users()->where('user_id', $member->id)->exists()) {
$org->users()->attach($member, ['role' => 'org_member']);
}
}
}