Currently, if a model doesn't explicitly have a policy mapped, Laravel will attempt two things in this order:
Guessing the policy name, optionally with a custom callback;
Checking if the model is a subclass of a model mapping a policy.
I frequently use model subclasses, and came across an instance where Laravel guessed the wrong policy name rather than selecting the policy based on the parent class.
Is there a good reason for this order? I would suggest that guessing should be the fallback option after explicit mapping & parent mapping fail. I suspect this would be a low impact change, as presumably few developers rely on guessing policies for their subclassed models?
Currently, if a model doesn't explicitly have a policy mapped, Laravel will attempt two things in this order:
I frequently use model subclasses, and came across an instance where Laravel guessed the wrong policy name rather than selecting the policy based on the parent class.
Is there a good reason for this order? I would suggest that guessing should be the fallback option after explicit mapping & parent mapping fail. I suspect this would be a low impact change, as presumably few developers rely on guessing policies for their subclassed models?