LaravelPackages.net
Acme Inc.
Toggle sidebar
upline/fill-button

Button to fill other fields in Laravel Nova resource form

71
0
1.0.1
About upline/fill-button

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

Fill button

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
Comments