PHP code example of pavloniym / nova-options-selector

1. Go to this page and download the library: Download pavloniym/nova-options-selector 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/ */

    

pavloniym / nova-options-selector example snippets


use Pavloniym\OptionsSelector\OptionsSelector;

public function fields(Request $request)
{
    return [
      OptionsSelector::make('Permissions', 'permissions')
        ->options([
            [
                'group' => [
                    'title' => 'Account permissions',
                ],
                'entries' => [
                    [
                        'key' => 'account:update',
                        'title' => 'Update account',
                        'description' => 'User can update any account in database'
                    ],
                    [
                        'key' => 'account:selfDelete',
                        'title' => 'Delete self account'
                    ],
                ]
            ],
            // ...
        ])

        // Optional:
        ->searchable() // show search bar on form and detail views
        ->setGridColumnsGap(4)  // set gap between columns
        ->setGridColumnsWidth(250) // set grid columns width in pixels
        ->setMaxRowWidthOnIndex('200px') // set max with on index field
    ];
}