Replies: 3 comments 18 replies
-
Are you using teams? version? |
Beta Was this translation helpful? Give feedback.
2 replies
-
The task has his own cache instance, try clearing cache on every run, try app()->make(\Spatie\Permission\PermissionRegistrar::class)->forgetCachedPermissions();
// or
app()->make(\Spatie\Permission\PermissionRegistrar::class)->clearClassPermissions(); |
Beta Was this translation helpful? Give feedback.
5 replies
-
If |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone !
I'm using a cron task to dispatch a job everyday to send emails to people depending on a condition.
Laravel 9.51
Spatie Laravel-permission 5.9.1
Here is a sample of the code used:
But within the job or even from an invokable function, this code doesn't work and I've narrowed the problem down to the :
$company->contacts()->role('referer')->first();
It seems that the job cannot access the roles but this same code works perfectly when I put it in a controller method and call it from a url !
What could be the problem? Thanks a lot for your help!
Beta Was this translation helpful? Give feedback.
All reactions