PHP code example of dillingham / nova-conditional-fields

1. Go to this page and download the library: Download dillingham/nova-conditional-fields library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dillingham / nova-conditional-fields example snippets


use NovaConditionalFields\Condition;

Boolean::make('Show Fields'),

Condition::make('Show Fields')
    ->when(true, [
        Text::make('Extra Setting 1'),
        Text::make('Extra Setting 2'),
        Text::make('Extra Setting 3'),
    ])

Select::make('Type')->options([
    'type-1' => 'Type 1',
    'type-2' => 'Type 2',
]),

Condition::make('Type')
    ->fieldsWhen('type-1', [
        Text::make('Setting 1'),
        Text::make('Setting 2'),
        Text::make('Setting 3'),
    ])->when('type-2', [
        Text::make('Setting 4'),
        Text::make('Setting 5'),
        Text::make('Setting 6'),
    ])