v0.2.4
Duplication of a record through the nova admin panel along with any defined relations that are required (tested on HasMany). Creates a copy of the data in our admin panel and redirects to the view.
### Todo
- Duplicate relations alongside the main post.
- Catch errors properly
- Give a clearer notification to end users.
Install the duplicate field.
composer require jackabox/nova-duplicate-field
Reference the duplicate field at the top of your Nova resource and then include the necessary code within the fields.
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).
]),
Duplicate field only works on the index view and already passes through onlyOnIndex()
as an option.
If there are any issues or requests feel free to open a GitHub issue or a pull request.