PHPackages                             gabrielesbaiz/duplicate-toolkit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. gabrielesbaiz/duplicate-toolkit

ActiveLibrary[Database &amp; ORM](/categories/database)

gabrielesbaiz/duplicate-toolkit
===============================

A lightweight helper package to handle Eloquent model duplication.

1.1.0(1y ago)02.4k↑850%MITPHPPHP ^8.0CI passing

Since Mar 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/gabrielesbaiz/duplicate-toolkit)[ Packagist](https://packagist.org/packages/gabrielesbaiz/duplicate-toolkit)[ Docs](https://github.com/gabrielesbaiz/duplicate-toolkit)[ GitHub Sponsors]()[ RSS](/packages/gabrielesbaiz-duplicate-toolkit/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (10)Versions (3)Used By (0)

[![Latest Version on Packagist](https://camo.githubusercontent.com/16705fa528fe0c32f52741d225413be97189b7b43237678afbaa498a014902e5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6761627269656c65736261697a2f6475706c69636174652d746f6f6c6b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gabrielesbaiz/duplicate-toolkit)[![Total Downloads](https://camo.githubusercontent.com/99aa4dc923177c621a0a5aaf9a4e59d61d82301f43a35fb569e16d9a0387c4e8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6761627269656c65736261697a2f6475706c69636174652d746f6f6c6b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gabrielesbaiz/duplicate-toolkit)

A lightweight helper package to handle Eloquent model duplication.

Original code from [neurony/laravel-duplicate](https://github.com/neurony/laravel-duplicate)

Features
--------

[](#features)

- ✅ Duplicate any Eloquent model record along with its underlying relationships.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require gabrielesbaiz/duplicate-toolkit
```

Usage
-----

[](#usage)

### Step 1

[](#step-1)

Your Eloquent models should use the `Gabrielesbaiz\DuplicateToolkit\Traits\HasDuplicates` trait and the `Gabrielesbaiz\DuplicateToolkit\Options\DuplicateOptions` class.

The trait contains an abstract method `getDuplicateOptions()` that you must implement yourself.

Example:

```
