diff --git a/Database/Seeders/CompanyDatabaseSeeder.php b/Database/Seeders/CompanyDatabaseSeeder.php index 7d300cb..a82c099 100644 --- a/Database/Seeders/CompanyDatabaseSeeder.php +++ b/Database/Seeders/CompanyDatabaseSeeder.php @@ -21,8 +21,10 @@ $data = $this->data(); foreach ($data as $value) { - $permission = Permission::create([ - 'name' => $value['name'], + $permission = Permission::updateOrCreate([ + 'name' => $value['name'], + 'guard_name' => 'web' + ], [ 'permission_group_id' => $value['group'], ]); @@ -37,11 +39,11 @@ // list of model permission $model = ['company']; - $permissionGroup = PermissionGroup::create([ - 'name' => 'company' - ]); - foreach ($model as $value) { + $permissionGroup = PermissionGroup::updateOrCreate([ + 'name' => $value + ]); + foreach ($this->crudActions($value) as $action) { $data[] = ['name' => $action, 'group' => $permissionGroup->id]; }