Skip to content

Commit 394b4e4

Browse files
author
Jack Whiting
committed
allowing for duplication of relations also, bumping version
1 parent ce4170f commit 394b4e4

File tree

7 files changed

+40
-2126
lines changed

7 files changed

+40
-2126
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
**v0.2.0**
2+
13
# Nova Duplicate Field
24

3-
Currently only duplicates the main record and no relations but this is on the todo list. Meta needs passing through to ensure the right models are replicated and redirection to the new entry happens.
5+
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.
46

57
### Todo
68

7-
- [ ] Duplicate relations alongside the main post.
9+
- [x] Duplicate relations alongside the main post.
810
- [ ] Catch errors properly
911
- [ ] Give a clearer notification to end users.
1012

@@ -28,6 +30,7 @@ DuplicateField::make('Duplicate')
2830
'resource' => 'specialisms', // resource url
2931
'model' => 'App\Models\Specialism', // model path
3032
'id' => $this->id // id of record
33+
'relations' => ['one', 'two'] // an array of any relations to load (nullable).
3134
]),
3235
```
3336

@@ -36,3 +39,7 @@ Duplicate field only works on the index view and already passes through `onlyOnI
3639
### Demo
3740

3841
![Duplicate Field Image](./img/nova-duplicate-field-small.gif)
42+
43+
## Issues
44+
45+
If there are any issues or requests feel free to open a GitHub issue or a pull request.

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "jackabox/nova-duplicate-field",
33
"description": "A Laravel Nova field to duplicate records.",
4+
"version": "v0.2.0",
45
"keywords": [
56
"laravel",
67
"nova",

0 commit comments

Comments
 (0)