wamesk / laravel-nova-currency
Laravel Nova 4 Currency field.
2.0.10
2024-09-04 08:37 UTC
Requires
- calebporzio/sushi: ^v2.5.2
- interaction-design-foundation/nova-html-card: ^3.0
- laravel/nova: ^4.0
- moneyphp/money: ^4.5
README
Requirements
laravel/nova: ^4.0
Installation
composer require wamesk/laravel-nova-currency
php artisan migrate
php artisan db:seed --class=CurrencySeeder
Add Policy to ./app/Providers/AuthServiceProvider.php
protected $policies = [ 'Wame\LaravelNovaCurrency\Models\Currency' => 'src\Policies\CurrencyPolicy', ];
Usage
Select::make(__('laravel-nova-currency::customer.field.currency'), 'currency_code') ->help(__('laravel-nova-currency::customer.field.currency.help')) ->options(fn () => CurrencyController::getListForSelect()) ->searchable() ->required() ->rules('required') ->onlyOnForms(), BelongsTo::make(__('laravel-nova-currency::customer.field.currency'), 'currency', Currency::class) ->displayUsing(fn () => CurrencyController::displayUsing($request, $this)) ->sortable() ->filterable() ->showOnPreview() ->exceptOnForms(),
Updating the exchange rates
This package also includes a scheduling command to start updating the exchange rates every weekday at 16:15.