Action authorize() method not working
I have an action on a model called claim that is related to updaing a document.
My action below uses a method on the DocumentPolicy to tell whether a user can upload a document.
It no longer works like in v3, as the method
downloadRequiredDocument
never gets called, and I can not see the button etc.
I can see that even though I include Document::class
to the method it still tries to call a method on the ClaimPolicy
(using ray).
Is this a bug, or am I missing something?
My action:
My DocumentPolicy method:
2 Replies
The docs also don't mention using a different policy than the one for the current resource: https://filamentphp.com/docs/4.x/actions/overview#authorization-using-a-policy
@Harvey in your policy return Response::allow() or Response::deny() it will work automatically. For Boolean return you can use visible or hidden methods