From 99811cbb74c7b3ab238be6fff7960a471138b9bb Mon Sep 17 00:00:00 2001 From: Ali Kazmi Date: Sat, 4 Jun 2022 17:36:40 +0500 Subject: [PATCH] Updates AuthorizationGivePermissionsToRolesSeeder_3.php to use role model from config (#681) - Role model was hard coded and that was ignoring, customized role model which spetie package allows - Simple update to use role model as specified in configuration file, instead using directly --- .../Seeders/AuthorizationGivePermissionsToRolesSeeder_3.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Containers/AppSection/Authorization/Data/Seeders/AuthorizationGivePermissionsToRolesSeeder_3.php b/app/Containers/AppSection/Authorization/Data/Seeders/AuthorizationGivePermissionsToRolesSeeder_3.php index 8792596a7..6b845fe14 100644 --- a/app/Containers/AppSection/Authorization/Data/Seeders/AuthorizationGivePermissionsToRolesSeeder_3.php +++ b/app/Containers/AppSection/Authorization/Data/Seeders/AuthorizationGivePermissionsToRolesSeeder_3.php @@ -4,7 +4,6 @@ use App\Containers\AppSection\Authorization\Tasks\GetAllPermissionsTask; use App\Ship\Parents\Seeders\Seeder as ParentSeeder; -use Spatie\Permission\Models\Role; class AuthorizationGivePermissionsToRolesSeeder_3 extends ParentSeeder { @@ -12,9 +11,10 @@ public function run(): void { // Give all permissions to 'admin' role on all Guards ---------------------------------------------------------------- $adminRoleName = config('appSection-authorization.admin_role'); + $roleModel = config('permission.models.role'); foreach (array_keys(config('auth.guards')) as $guardName) { $allPermissions = app(GetAllPermissionsTask::class)->whereGuard($guardName)->run(true); - $adminRole = Role::findByName($adminRoleName, $guardName); + $adminRole = $roleModel::findByName($adminRoleName, $guardName); $adminRole->givePermissionTo($allPermissions); }