wamesk/laravel-nova-currency

Laravel Nova 4 Currency field.

2.0.10 2024-09-04 08:37 UTC

This package is auto-updated.

Last update: 2025-01-04 09:19:30 UTC


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.

Running The Scheduler