upline / fill-button
Button to fill other fields in Laravel Nova resource form
1.0.1
2022-04-29 16:34 UTC
Requires
- php: ^7.4|^8
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Button for filling some form fields using values of other fields in laravel nova resource forms.
Example
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'])
Explanation
->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.
To be done
- Add image/video of component to readme
- Test on nova 4
- Add tests