The package can be installed through Composer.
composer require izi-dev/nova-conditional-field
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'")
];
}
}
The MIT License (MIT)