Button to fill other fields in Laravel Nova resource form
upline/fill-button is a Laravel package for button to fill other fields in laravel nova resource form.
It currently has 0 GitHub stars and 71 downloads on Packagist (latest version 1.0.1).
Install it with composer require upline/fill-button.
Discover more Laravel packages by upline
or browse all Laravel packages to compare alternatives.
Last updated
Button for filling some form fields using values of other fields in laravel nova resource forms.
use Upline\FillButton;
FillButton::make('Fill total fields', 'fill-prices')
->setFillFunction(function ($data) {
return [
'total' => $data['price'] + $data['quantity'],
'totalDiscount' => $data['discount'] + $data['quantity'],
];
})
->setSourceFields(['price', 'discount', 'quantity'])
->setSourceFields($fields) method sets fields that will be watched for changes, and will be sent on the button click.
->setFillFunction(...) method sets a function that will be called to calculate values to fill the fields.