Skip to content

Commit c554d36

Browse files
authored
Merge pull request #104 from daniel-omnistock/feature/seed-roles-by-slug
Fix: First try to get the Admin role by 'slug'. If that fails, try to get it by 'name', as for backwards compatibility
2 parents 7d05c0a + 89b548d commit c554d36

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Database/Seeds/DefaultConnectRelationshipsSeeder.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ public function run()
2121
/**
2222
* Attach Permissions to Roles.
2323
*/
24-
$roleAdmin = config('roles.models.role')::where('name', '=', 'Admin')->first();
24+
$roleAdmin = config('roles.models.role')::where('slug', '=', 'admin')->first()
25+
?? config('roles.models.role')::where('name', '=', 'Admin')->first();
26+
2527
echo "\e[32mSeeding:\e[0m DefaultConnectRelationshipsSeeder\r\n";
2628
foreach ($permissions as $permission) {
2729
$roleAdmin->attachPermission($permission);

0 commit comments

Comments
 (0)