Conditionally show relation manager
My items model, if a condition is met, will be able to have users or not.
This condition can be calculated by retrieving the model and doing some simple checks on it.
As i know which models can have users or not, i want to hide the users table in the edit page when they aren't able to have that relationship. any ideas how to achieve it?
This condition can be calculated by retrieving the model and doing some simple checks on it.
As i know which models can have users or not, i want to hide the users table in the edit page when they aren't able to have that relationship. any ideas how to achieve it?
Solution
you can find your answer here:
https://filamentphp.com/docs/3.x/panels/resources/relation-managers#conditionally-showing-relation-managers
You have to edit your RelationManager file and add the canViewForRecord function, and add your conditions inside.
https://filamentphp.com/docs/3.x/panels/resources/relation-managers#conditionally-showing-relation-managers
You have to edit your RelationManager file and add the canViewForRecord function, and add your conditions inside.