Authorization in RelationManager not allowing to use different model
Hi,
I have a
UserResource
with a TokenRelationManager
.
The tokens use model Laravel\Sanctum\PersonalAccessToken
.
I have the following header action on the relation manager:
As you can see in ->authorize('createToken', User::class)
I want to trigget the createToken
method on the UserPolicy
.
Because of this code in the InteractsWithRecord
trait the model of the relation manager gets prepended as an argument:
How could I trigger the authorization method to use the UserPolicy
?1 Reply
Solution
I solved this issue by using:
and
I do not know if this is the best possible solution, but it works 🤷♂️