PHP code example of outhebox / nova-duplicate-field

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

    

outhebox / nova-duplicate-field example snippets


use OutheBox\DuplicateField\DuplicateField

DuplicateField::make('Duplicate')
    ->withMeta([
        'id' => $this->id, // id of record
        'model' => 'App\Models\Specialism', // model path
        '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).
        'resource' => 'specialisms', // resource url
        'relations' => ['one', 'two'], // an array of any relations to load (nullable).
    ]),