PHP code example of forest-lynx / moonshine-decimal-field

1. Go to this page and download the library: Download forest-lynx/moonshine-decimal-field library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

forest-lynx / moonshine-decimal-field example snippets



//...
use ForestLynx\MoonShine\Fields\Decimal;
//...
Decimal::make('Price', 'price');


use ForestLynx\MoonShine\Fields\Decimal;
//...
Decimal::make('Sum', 'sum')
   ->precision(2, true);
//or
Decimal::make('Sum', 'sum')
   ->naturalNumber();
//...

>
>use ForestLynx\MoonShine\Fields\Decimal;
>//...
>Decimal::make('Sum', 'sum')
>   ->precision(3)
>   ->naturalNumber(4);
>//...
>


use ForestLynx\MoonShine\Fields\Decimal;
//...
Decimal::make('Price', 'price')
    ->unit('unit', ['килограмм.', 'литр'])
    ->unitDefault(0);
//or
Decimal::make('Price', 'price')
    ->unit('unit', [0 => 'килограмм.', 1 => 'литр'])
    ->unitDefault(1);
//or
Decimal::make('Price', 'price')
    ->unit('unit', UnitEnum::class)
    ->unitDefault(UnitEnum::KILOGRAM);
//...