wamesk / laravel-nova-currency
Laravel Nova 4 Currency field.
1.1.3
2023-11-21 09:52 UTC
Requires
- interaction-design-foundation/nova-html-card: ^3.0
- laravel/nova: ^4.0
- wamesk/laravel-commands: ^1.0
README
Requirements
laravel/nova: ^4.0
Installation
composer require wamesk/laravel-nova-currency
php artisan vendor:publish --provider="Wame\LaravelNovaCurrency\PackageServiceProvider"
php artisan migrate
php artisan db:seed --class=CurrencySeeder
Add Policy to ./app/Providers/AuthServiceProvider.php
protected $policies = [ 'App\Models\Currency' => 'App\Policies\CurrencyPolicy', ];
Usage
Select::make(__('customer.field.currency'), 'currency_code') ->help(__('customer.field.currency.help')) ->options(fn () => CurrencyController::getListForSelect()) ->searchable() ->required() ->rules('required') ->onlyOnForms(), BelongsTo::make(__('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.