izi-dev/nova-conditional-field

Conditional Field

Installs: 22 931

Dependents: 0

Suggesters: 0

Security: 0

Stars: 16

Watchers: 1

Forks: 3

Open Issues: 9

Language:Vue

2.1.0 2020-07-17 21:11 UTC

This package is auto-updated.

Last update: 2025-03-05 22:28:55 UTC


README


Demo

Demo


Installation

The package can be installed through Composer.

composer require izi-dev/nova-conditional-field

Usage

class Page extends Resource
{

    public function fields(Request $request)
    {
        return [
            
            Select::make(__('Type'), 'type')
                ->options([]),
            //Condition in BACKEND

            KeyValue::make(__('Options'), 'option')
                ->if(['type'], fn($value) => $value['type'] === 'value')
            
            //Condition in FRONT
                ->if(['type'], "_value.type === 'value'")

        ];
    }
}

License

The MIT License (MIT)