RoleDoesNotExist: guard_name defaults to 'sanctum' when seeding in multitenancy setup #2040
-
Hi all, I'm playing with some different setups for roles & perms in a multi-tenancy setup - saw #1744 and may investigate further, but my case will likely require tenants to modify some roles/perms. When seeding my roles/perms during the tenant setup process, the guard_name is being set to 'sanctum' - resulting in a I am confused about where this is coming from - I don't even have sanctum listed as a possible guard. I can solve this by hardcoding 'web' as the guard_name during creation, but I'd like to understand what is happening here. I am using the multi-tenancy package, and extending the Role & Perm model to add I am running the seed command in a controller [Controller.php] $tenant->makeCurrent();
...
...
// seed roles and permissions
Artisan::call("tenants:artisan 'db:seed --class RolesAndPermissionsSeeder' --tenant=".$tenant->id);
$admin->assignRole('super-admin'); // <----- exception thrown here
Tenant::forgetCurrent(); Some other relevant bits: [auth.php] 'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'landlord' => [
'driver' => 'session',
'provider' => 'landlords',
],
], [sanctum.php] 'guard' => 'web' When I run this in tinker, or console I get the correct guard. I suspect this has to do with a knowledge gap in sanctum, since even doing Any thoughts or advice greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Yes, but on your implementation |
Beta Was this translation helpful? Give feedback.
-
For the record, this has nothing to do with the package at all - it was in the route definition at the top of the file: Route::middleware(['auth:sanctum', 'verified'])->group(..... PEBKAC. |
Beta Was this translation helpful? Give feedback.
For the record, this has nothing to do with the package at all - it was in the route definition at the top of the file:
PEBKAC.