how to globally disable create another ?
how to globally disable all create another ? like in a service provider can you do that?
4 Replies
your question is pretty vague ngl.. I think you are looking for the usage of policies, which FIlament automatically enforces
https://filamentphp.com/docs/3.x/panels/resources/viewing-records#authorization this goes for pretty much all default filament actions. you will have to enforce it on custom actions/pages yourself
Thanks for the input!
I was hoping there might be a simpler way to globally disable the 'Create Another' button, perhaps through a setting in the panel or a method in a service provider. From what I understand, it seems like I'd need to set:
on each individual create page. Is that really the only approach, or is there a more global solution, like a method such as $panel->disableCreateAnotherButtonGlobally() that could handle it across all resources?
should be gone when the policy returns false when a record exists?
else you can set a default in AppServiceProvider like so (works for almost all filament components)
https://filamentphp.com/docs/3.x/tables/advanced#global-settings
this will set a default for all of them across the entire app tho, you can override it when needed
now I think about it there might be a way to set it in the panel provider aswell, let me check
yep this seems to work aswell in the panel provider:
not sure if thats the intended way to go about it though ( @KingStalker )
thanks i give it a go when i get back