PHP code example of zetrider / nova-inputs-field

1. Go to this page and download the library: Download zetrider/nova-inputs-field 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/ */

    

zetrider / nova-inputs-field example snippets


$table->text('fields')->nullable();
// Or
$table->longText('fields')->nullable();
// Or
$table->json('fields')->nullable();

/**
    * The attributes that should be cast.
    *
    * @var array
*/
protected $casts = [
    'fields' => 'array',
];

use ZetRider\NovaInputsField\NovaInputsField;

public function fields(Request $request)
{
    return [
        NovaInputsField::make('Some field', 'fields')
            // Simple text field
            ->input('exampleTest', ['type' => 'text', 'placeholder' => 'Type here...'])
            // Color field
            ->input('exampleColor', ['type' => 'color'])
            // Date field
            ->input('exampleDate', ['type' => 'date', 'min' => now()->format('Y-m-d')])
            // Simple select
            ->select('exampleSelect', ['placeholder' => 'Select option...'], [
                'value1' => 'Option1',
                'value2' => 'Option2',
                'value3' => 'Option3'
            ])
            // Multiple select
            ->select('exampleMultiple', ['placeholder' => 'Select option...', 'multiple' => 'multiple', 'style' => 'height: 100px;'], [
                'value1' => 'Option1',
                'value2' => 'Option2',
                'value3' => 'Option3'
            ])
            // Checkbox
            ->checkbox('exampleCheckbox', ['placeholder' => 'Choice option'], [
                'value1' => 'Check1',
                'value2' => 'Check2',
                'value3' => 'Check3'
            ])
            // Radio
            ->radio('exampleRadio', ['placeholder' => 'Some title'], [
                'value1' => 'Radio1',
                'value2' => 'Radio2',
                'value3' => 'Radio3'
            ]),
    ];
}

NovaInputsField::make('Prices', 'prices')
    ->select('type', [], ['base' => 'Base', 'sale' => 'Sale'])
    ->input('price', ['type' => 'nubmer', 'min' => '1', 'step' => '0.01']),