F
Filament13mo ago
Kornel

How to show a field only in create record

I want to show a field only while creating a new record. Other case is to make a field required but only while creating new record. While editing this field should be optional. I can't find any way of doing this in the docs.
Solution:
->hiddenOn('edit'),
->required(fn(string $operation) => $operation == 'create'),
->hiddenOn('edit'),
->required(fn(string $operation) => $operation == 'create'),
...
Jump to solution
1 Reply
Solution
torriv
torriv13mo ago
->hiddenOn('edit'),
->required(fn(string $operation) => $operation == 'create'),
->hiddenOn('edit'),
->required(fn(string $operation) => $operation == 'create'),
https://filamentphp.com/docs/3.x/panels/resources/getting-started#hiding-components-based-on-the-current-operation https://filamentphp.com/docs/3.x/forms/advanced#injecting-the-current-form-operation
Want results from more Discord servers?
Add your server