Teams and Policies #2866
-
Been stumped on this one for a bit and hoping for some insight. I've followed the outlined steps https://spatie.be/docs/laravel-permission/v6/basic-usage/teams-permissions and kept everything pretty much default. My team middleware is identical to the example. Using Livewire, I have a delete method that checks against a delete policy. public function delete(User $user, RoyaltyRate $royaltyRate): bool
{
setPermissionsTeamId(session('team_id'));
$user->unsetRelation('roles')->unsetRelation('permissions');
dd($user->getAllPermissions(), $user->can('test'));
return false;
}
The following code returns the following result ![]() Why does getAllPermissions() return the test permission, but $user->can('test') return false. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You always find the solution once you ask about it... https://livewire.laravel.com/docs/security#configuring-persistent-middleware This forces the middleware to always be available and cleans things up. |
Beta Was this translation helpful? Give feedback.
You always find the solution once you ask about it...
https://livewire.laravel.com/docs/security#configuring-persistent-middleware
This forces the middleware to always be available and cleans things up.