Skip to content

Commit

Permalink
Fixed passing null to methods that require a string.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebronner committed Sep 6, 2022
1 parent 9d51fc8 commit bb37898
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
5 changes: 5 additions & 0 deletions database/seeders/LaravelGovernorAdminSeeder.php
Expand Up @@ -13,6 +13,11 @@ public function run()
$adminRole = (new $roleClass)->find("Admin");
$memberRole = (new $roleClass)->find("Member");
$admins = config('genealabs-laravel-governor.admins');

if (! $admins) {
return;
}

$admins = json_decode($admins);

if (! is_array($admins)) {
Expand Down
21 changes: 13 additions & 8 deletions database/seeders/LaravelGovernorSuperAdminSeeder.php
Expand Up @@ -12,24 +12,29 @@ public function run()
$roleClass = config("genealabs-laravel-governor.models.role");
$superAdminRole = (new $roleClass)->find("SuperAdmin");
$memberRole = (new $roleClass)->find("Member");
$superadmins = config('genealabs-laravel-governor.superadmins');
$superadmins = json_decode($superadmins);
$superAdmins = config('genealabs-laravel-governor.superadmins');

if (!is_array($superadmins)) {
if (! $superAdmins) {
return;
}

foreach ($superadmins as $superadmin) {
if ($superadmin->email) {
$superAdmins = json_decode($superAdmins);

if (! is_array($superAdmins)) {
return;
}

foreach ($superAdmins as $superAdmin) {
if ($superAdmin->email) {
$superuser = $users
->firstOrNew([
"email" => $superadmin->email,
"email" => $superAdmin->email,
]);

if (!$superuser->exists) {
$superuser->fill([
"name" => $superadmin->name,
"password" => bcrypt($superadmin->password),
"name" => $superAdmin->name,
"password" => bcrypt($superAdmin->password),
]);
$superuser->save();
}
Expand Down
Binary file modified tests/database/database.sqlite
Binary file not shown.

0 comments on commit bb37898

Please sign in to comment.