Livewire component functions missing team_id #2714
Replies: 2 comments
-
Looks like there's more going on with my setup. I'm gonna check that first, closing this issue for now. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Update: #2715 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are using the following versions:
The Issue:
I'm encountering an issue where the teamId behaves inconsistently when checking user permissions within a Livewire component. Specifically:
Example:
We have a Livewire component with a corresponding Blade file. The Blade file contains the following code:
The PostPolicy is as follows:
The
@cannot
directive in the Blade file correctly evaluates the user's permissions based on theirteam_id
.Logging the user inside the policy shows that the correct user, with roles and
team_id
, is being used.The Problem:
When the user clicks on the "Save" button, I attempt to check the authorization again in the Livewire component’s save method:
This always returns false. Logging the user and permissions at this point reveals that the user has no roles and the
team_id
is missing. ThegetPermissionsTeamId()
method returns null in this scenario.We have the following middleware for setting the teamId:
In bootstrap/app.php, the middleware is appended like this:
Request for Help:
Can anyone explain why the permission check in the save function of the Livewire component is not aware of the current
team_id
? Any insights on how to resolve this issue?Beta Was this translation helpful? Give feedback.
All reactions