how to remove duplicate record in db table laravel code example
Example: laravel eloquent duplicate record
// Retrieve the first task
$task = Task::first();
$newTask = $task->replicate();
$newTask->project_id = 16; // the new project_id
$newTask->save();