diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index ae436a07..0b856e54 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -13,11 +13,11 @@ class DatabaseSeeder extends Seeder */ public function run(): void { - // User::factory(10)->withPersonalTeam()->create(); - - User::factory()->withPersonalTeam()->create([ - 'name' => 'Test User', - 'email' => 'test@example.com', + $this->call([ + MenuSeeder::class, + RolesSeeder::class, + TeamSeeder::class, + UserSeeder::class, ]); } } diff --git a/database/seeders/RolesSeeder.php b/database/seeders/RolesSeeder.php index 16fa0e4c..fa272c6d 100644 --- a/database/seeders/RolesSeeder.php +++ b/database/seeders/RolesSeeder.php @@ -13,12 +13,12 @@ class RolesSeeder extends Seeder */ public function run(): void { - $adminRole = Role::firstOrCreate(['name' => 'admin']); + $roles = ['admin', 'staff', 'client', 'free']; $permissions = Permission::where('guard_name', 'web')->pluck('id')->toArray(); - $adminRole->syncPermissions($permissions); - $freeRole = Role::firstOrCreate(['name' => 'free']); - $freePermissions = Permission::where('guard_name', 'web')->pluck('id')->toArray(); - $freeRole->syncPermissions($freePermissions); + foreach ($roles as $roleName) { + $role = Role::firstOrCreate(['name' => $roleName]); + $role->syncPermissions($permissions); + } } } diff --git a/database/seeders/SiteSettingsSeeder.php b/database/seeders/SiteSettingsSeeder.php index dca08597..af415f0e 100644 --- a/database/seeders/SiteSettingsSeeder.php +++ b/database/seeders/SiteSettingsSeeder.php @@ -10,12 +10,20 @@ class SiteSettingsSeeder extends Seeder public function run() { SiteSettings::create([ - 'name' => config('app.name', 'Liberu Real Estate'), + 'name' => config('app.name', 'Liberu '), 'currency' => '£', 'default_language' => 'en', - 'address' => '123 Real Estate St, London, UK', + 'address' => '123 St, London, UK', 'country' => 'United Kingdom', 'email' => 'info@liberurealestate.com', + 'phone_01' => '+44 123 456 7890', + 'phone_02' => '+44 123 456 7890', + 'phone_03' => '+44 123 456 7890', + 'phone_04' => '+44 123 456 7890', + 'facebook' => 'https://facebook.com/liberusoftware', + 'twitter' => 'https://twitter.com/liberusoftware', + 'github' => 'https://Github.com/liberusoftware', + 'youtube' => 'https://YouTube.com/@liberusoftware', ]); } } \ No newline at end of file diff --git a/database/seeders/TeamSeeder.php b/database/seeders/TeamSeeder.php new file mode 100644 index 00000000..f3078d65 --- /dev/null +++ b/database/seeders/TeamSeeder.php @@ -0,0 +1,23 @@ + 1, + 'name' => 'default', + 'personal_team' => false, + 'user_id' => 1, + ]); + } +} diff --git a/database/seeders/UserSeeder.php b/database/seeders/UserSeeder.php new file mode 100644 index 00000000..28e64244 --- /dev/null +++ b/database/seeders/UserSeeder.php @@ -0,0 +1,47 @@ + 'Admin User', + 'email' => 'admin@example.com', + 'password' => Hash::make('password'), + 'email_verified_at' => now(), + ]); + $adminUser->assignRole('admin'); + + $staffUser = User::create([ + 'name' => 'Staff User', + 'email' => 'staff@example.com', + 'password' => Hash::make('password'), + 'email_verified_at' => now(), + ]); + $staffUser->assignRole('staff'); + + // Create teams for admin and staff users + $this->createTeamForUser($adminUser); + $this->createTeamForUser($staffUser); + } + + private function createTeamForUser($user) + { + $team = Team::first(); + $team->users()->attach($user); + + $user->current_team_id = 1; + $user->save(); + } +}