PHP code example of jackabox / nova-duplicate-field

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

    

jackabox / nova-duplicate-field example snippets


use Jackabox\DuplicateField\DuplicateField

DuplicateField::make('Duplicate')
    ->withMeta([
        'resource' => 'specialisms', // resource url
        'model' => 'App\Models\Specialism', // model path
        'id' => $this->id, // id of record
        'relations' => ['one', 'two'], // an array of any relations to load (nullable).
        'except' => ['status'], // an array of fields to not replicate (nullable).
        'override' => ['status' => 'pending'] // an array of fields and values which will be set on the modal after duplicating (nullable).
    ]),