Copy (Replicate) an Eloquent Model

Use following script will create a new object:

$model = $this->replicate();

But this script will remove attribute “id”, so if you want to keep attribute “id”, need to do this:

$model->id = $this->id;

Reference: