F
Filament17mo ago
BATMAN

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
Sujal Tamrakar17mo ago
You can return different form schema in Create and Edit pages
Vp
Vp17mo 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 Koch17mo ago
Instead of defining it on the resouce, define getFormSchema() on the page directly.
BATMAN
BATMANOP17mo ago
thx alot
toeknee
toeknee17mo 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')
Want results from more Discord servers?
Add your server