/nova-conditional-if

If you need to hide a field by means of a condition of another field, this package is perfect.

Primary LanguageVue

Nova Field Conditional


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)