Is it possible to pass the parent record to the gate of a relation manager?
I have a
I only want to allow a work order note to be created on work orders that the logged in user owns. The problem is that Filament checks a
Is there a way that I can pass in the parent/owner record to this method on the policy?
Work Orders resource and on the edit page of each is a relation manager for Work Order Notes. I have policies for both models.I only want to allow a work order note to be created on work orders that the logged in user owns. The problem is that Filament checks a
create method on the WorkOrderNotePolicy that doesn't pass in anything other than the user. Eg.Is there a way that I can pass in the parent/owner record to this method on the policy?
Solution
This is what I ended up doing on the relation manager. There are several
canAction methods on the relation manager and I override the one's I need. Not sure if this is the best way to do this though but it works.