diff --git a/app/Http/Controllers/Auth/RegisteredUserController.php b/app/Http/Controllers/Auth/RegisteredUserController.php index 53a546b..e43402a 100644 --- a/app/Http/Controllers/Auth/RegisteredUserController.php +++ b/app/Http/Controllers/Auth/RegisteredUserController.php @@ -42,6 +42,8 @@ public function store(Request $request): RedirectResponse 'password' => Hash::make($request->password), ]); + $user->assignRole('user'); + event(new Registered($user)); Auth::login($user); diff --git a/database/seeders/RoleSeeder.php b/database/seeders/RoleSeeder.php index 8295065..1d466ff 100644 --- a/database/seeders/RoleSeeder.php +++ b/database/seeders/RoleSeeder.php @@ -24,11 +24,10 @@ public function run(): void DB::table('role_has_permissions')->truncate(); DB::table('model_has_permissions')->truncate(); DB::table('model_has_roles')->truncate(); - + $adminRole = Role::create(['name' => 'admin']); - $manager = Role::create(['name' => 'manager']); - $agent = Role::create(['name' => 'agent']); - $support = Role::create(['name' => 'support']); + $moderator = Role::create(['name' => 'moderator']); + $user = Role::create(['name' => 'user']); Schema::disableForeignKeyConstraints(); activity()->enableLogging(); diff --git a/database/seeders/UserSeeder.php b/database/seeders/UserSeeder.php index 51f7201..2c11ba3 100644 --- a/database/seeders/UserSeeder.php +++ b/database/seeders/UserSeeder.php @@ -22,37 +22,7 @@ public function run(): void 'first_name' => 'Super', 'last_name' => 'Admin', 'email' => 'admin@admin.com', - 'password' => bcrypt('123456789'), - 'email_verified_at' => now(), - 'created_at' => now(), - 'updated_at' => now(), - 'deleted_at' => null, - ]); - $manager = User::create([ - 'first_name' => 'Manager', - 'last_name' => '', - 'email' => 'manager@example.com', - 'password' => bcrypt('123456789'), - 'email_verified_at' => now(), - 'created_at' => now(), - 'updated_at' => now(), - 'deleted_at' => null, - ]); - $agent = User::create([ - 'first_name' => 'Agent', - 'last_name' => 'Manager', - 'email' => 'agent@example.com', - 'password' => bcrypt('123456789'), - 'email_verified_at' => now(), - 'created_at' => now(), - 'updated_at' => now(), - 'deleted_at' => null, - ]); - $support = User::create([ - 'first_name' => 'support', - 'last_name' => 'User', - 'email' => 'support@example.com', - 'password' => bcrypt('123456789'), + 'password' => bcrypt('123456789'), 'email_verified_at' => now(), 'created_at' => now(), 'updated_at' => now(), @@ -60,10 +30,7 @@ public function run(): void ]); $superAdmin->assignRole('admin'); - $manager->assignRole('manager'); - $agent->assignRole('agent'); - $support->assignRole('support'); - + Schema::disableForeignKeyConstraints(); activity()->enableLogging(); }