How to calculate field value based on two other fields?

Hi, I have 3 fields: vehicle price, down payment and loan amount. When I fill vehicle price and down payment, I want to set loan amount value as vehicle price minus down payment.
TextInput::make('vehicle_price')
    ->suffix('€')
    ->reactive(),

TextInput::make('down_payment')
    ->suffix('€')
    ->reactive(),

TextInput::make('loan_amount')
    ->suffix('€'),
Was this page helpful?