Scoped Policies with multi guards
Hello, in my application, I have two guards wtih two different Models, Admin and User to handle my backend and frontend.
I have Policies on my existing Models for my frontend, though that accept User Model as first parameter of every method. Filament tries to use these Policies (https://filamentphp.com/docs/3.x/panels/resources/getting-started#authorization) but it obviously does not work since the argument passed is an instance of my Admin Model.
What i could do in my policies is to have a condition to check what type of User I have :
But i'd rather have distincts Policies in different directories like and
Can I achieve that ?
I have Policies on my existing Models for my frontend, though that accept User Model as first parameter of every method. Filament tries to use these Policies (https://filamentphp.com/docs/3.x/panels/resources/getting-started#authorization) but it obviously does not work since the argument passed is an instance of my Admin Model.
What i could do in my policies is to have a condition to check what type of User I have :
But i'd rather have distincts Policies in different directories like and
Can I achieve that ?
Solution
@LeandroFerreira Thank you for your answer, it helped me go on the right way ! This is the solution I made :