Skip to content
Discussion options

You must be logged in to vote

This seems to work fine for me.

public function fields(NovaRequest $request)
    {
        $currency = $this->currency ?? config('nova.currency');

        return [
            ID::make()->sortable(),

            Select::make('Currency')
                ->options([
                    'EUR' => 'EUR',
                    'MYR' => 'MYR',
                    'USD' => 'USD',
                ])
                ->default(fn () => $currency)
                ->displayUsingLabels(),

            Currency::make('Amount')
                ->dependsOn('currency', function (Currency $field, NovaRequest $request, FormData $formData) {
                    if (! empty($formData->currency)) {
            …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@rafaelsmith
Comment options

@crynobone
Comment options

@rafaelsmith
Comment options

Answer selected by crynobone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #4937 on October 18, 2022 11:15.