Different forms for create and edit

Hi i would like to ask how do i set forms differently when create and edit respectively
5 Replies
Sujal Tamrakar
You can return different form schema in Create and Edit pages
Vp
Vp2y ago
Check demo, Orders have different, you can check more details in the code https://github.com/filamentphp/demo/blob/main/app/Filament/Resources/Shop/OrderResource.php
Dennis Koch
Dennis Koch2y ago
Instead of defining it on the resouce, define getFormSchema() on the page directly.
BATMAN
BATMANOP2y ago
thx alot
toeknee
toeknee2y ago
You can also use context in the closures of the form depending what you are doing to avoid duplication. i.e.
->visible(fn($context) => $context === 'edit')
->visible(fn($context) => $context === 'edit')

Did you find this page helpful?