PHP code example of tuxones / filament-js-money-field
1. Go to this page and download the library: Download tuxones/filament-js-money-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/ */
tuxones / filament-js-money-field example snippets
use Tuxones\JsMoneyField\Forms\Components\JSMoneyInput;
JSMoneyInput::make('consumption_limit')
->currency('USD') // ISO 4217 Currency Code, example: USD
->locale('en-US') // BCP 47 Locale Code, example: en-US
// OR
JSMoneyInput::make('consumption_limit')
->hidden(fn (Get $get) => !$get('country'))
->currency(fn (Get $get) => $get('country') ? Country::find($get('country'))->currency : 'USD')
->locale(fn (Get $get) => $get('country') ? Country::find($get('country'))->locale : 'en-US')
use Tuxones\JsMoneyField\Tables\Columns\JSMoneyColumn;
JSMoneyColumn::make('consumption_limit')
->currency('USD') // ISO 4217 Currency Code, example: USD
->locale('en-US') // BCP 47 Locale Code, example: en-US
// OR
JSMoneyColumn::make('consumption_limit')
->currency(fn (Model $record) => $record->country ? $record->country->currency : 'USD')
->locale(fn (Model $record) => $record->country ? $record->country->locale : 'en-US')
use Tuxones\JsMoneyField\Infolists\Components\JSMoneyEntry;
JSMoneyEntry::make('consumption_limit')
->currency('USD') // ISO 4217 Currency Code, example: USD
->locale('en-US') // BCP 47 Locale Code, example: en-US
// OR
JSMoneyEntry::make('consumption_limit')
->currency(fn (Model $record) => $record->country ? $record->country->currency : 'USD')
->locale(fn (Model $record) => $record->country ? $record->country->locale : 'en-US')