From bbbc874558496bdc9145935c7542185a3eef00c0 Mon Sep 17 00:00:00 2001 From: Nathan Curtis Date: Mon, 15 Apr 2024 15:13:59 -0700 Subject: [PATCH] [TM-515] Only assign spatie roles if the user doesn't already have them. --- app/Console/Commands/Migration/RolesMigrationCommand.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/Migration/RolesMigrationCommand.php b/app/Console/Commands/Migration/RolesMigrationCommand.php index 85c5fb696..dde843401 100644 --- a/app/Console/Commands/Migration/RolesMigrationCommand.php +++ b/app/Console/Commands/Migration/RolesMigrationCommand.php @@ -72,7 +72,9 @@ public function handle() User::whereIn('role', ['user','admin', 'terrafund-admin'])->get() ->each(function (User $user) { - assignSpatieRole($user); + if ($user->primary_role == null) { + assignSpatieRole($user); + } }); if ($this->option('log')) {