F
Filament15mo ago
Connor

Create New Resource With Defaults?

Wondering if there is a way when creating a new email resource to start from a template, i.e. have a button for "quote email new" and it will create a new record with a pre-defined set of values for defaults?
No description
Solution:
So in each ->default() you can process it how ever you need to return the default state for the field. For example:
->default(function($state) { return the default based on the state })
->default(function($state) { return the default based on the state })
...
Jump to solution
6 Replies
awcodes
awcodes15mo ago
Just set defaults for your form fields.
Connor
ConnorOP15mo ago
I wish to have a few different types of templates though, so I'm looking for a way I can start the new email with around 3 or so different sets of defaults which is where I am unsure
Solution
awcodes
awcodes15mo ago
So in each ->default() you can process it how ever you need to return the default state for the field. For example:
->default(function($state) { return the default based on the state })
->default(function($state) { return the default based on the state })
awcodes
awcodes15mo ago
If you’re trying to return a whole different field that’s a different thing, but still doable.
Connor
ConnorOP15mo ago
Ahh right, this should make what I need todo more achievable. Appreciate the help!

Did you find this page helpful?