FilamentF
Filament16mo ago
Code A

Give default value to TextInput when Edit Data

This data is not in the same table so I have to get the data first in another table
Now from the data I took I want to give a default value in TextInput::make('custom_name')
How do I do that?

class OrderResource extends Resource
{


public static function form(Form $form): Form
{
$data = $form->getRecord();
if ($data !== null) {
$getData = User::find($data->partner_id);
}



return $form
->schema([
// ... form other
Forms\Components\TextInput::make('custom_name)
->label('Name')
->required(),

])
}
}

The data I took I put in the $getData variable, in the $getData variable there is a name, now I want to give it to the default TextInput custom_name
Was this page helpful?