Skip to content
2 changes: 2 additions & 0 deletions app/Http/Controllers/Auth/RegisteredUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 3 additions & 4 deletions database/seeders/RoleSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
37 changes: 2 additions & 35 deletions database/seeders/UserSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,48 +22,15 @@ 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(),
'deleted_at' => null,
]);

$superAdmin->assignRole('admin');
$manager->assignRole('manager');
$agent->assignRole('agent');
$support->assignRole('support');


Schema::disableForeignKeyConstraints();
activity()->enableLogging();
}
Expand Down