Default Function

I've used default function it's working on create page but it's not working on edit page.Can you please suggest me.
TextInput::make('comment')
->default(function ($record) {
// Set default value based on existing 'comment' attribute or a random string
return $record->comment ?? Str::random(8);
}),
TextInput::make('comment')
->default(function ($record) {
// Set default value based on existing 'comment' attribute or a random string
return $record->comment ?? Str::random(8);
}),
1 Reply
Dennis Koch
Dennis Koch5mo ago
Yes. That's mentioned in the docs. On Edit there is already a default (your data). If you want to modify check the mutate methods.