PHP code example of ziming / json-field-for-backpack

1. Go to this page and download the library: Download ziming/json-field-for-backpack 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/ */

    

ziming / json-field-for-backpack example snippets


$this->crud->addField([
    'name'  => 'column_name',
    'type'  => 'json',
    'view_namespace' => 'json-field-for-backpack::fields',
    
    // OPTIONAL
    
    // Which modes should the JsonEditor JS plugin allow?
    // Please note that the first mode in the array will be used as the default mode.
    'modes' => ['form', 'tree', 'code'],
     
    // Default value, if needed. If there is an actual value in the json column, 
    // it will do an array_merge_recursive(), with the json column values 
    // replacing the ones with the same keys.
    'default' => [],
]);
json.blade.php