#The given role or permission should use guard `` instead of `web`. - Spatie Roles in an artisan com
3 messages · Page 1 of 1 (latest)
Spatie's permission package uses the current guard to assign roles/permissions (and to fetch them). In an artisan command there is no guard, as it's not a web request, so you'd need to explicitly pass that
https://spatie.be/docs/laravel-permission/v6/basic-usage/multiple-guards#content-assigning-permissions-and-roles-to-guard-users
Also when creating a role outside of a http context, the guard would default to something, so might might want to explicitly create it for the web guard