Answers for "duplicate entries in laravel"

PHP
3

laravel duplicate row

$data = Model::find(1);
$new_data = $data->replicate();
$new_data->created_at = now();
$new_data->save();
Posted by: Guest on July-03-2021
2

laravel eloquent duplicate record

// Retrieve the first task
$task = Task::first();

$newTask = $task->replicate();
$newTask->project_id = 16; // the new project_id
$newTask->save();
Posted by: Guest on April-14-2020

Code answers related to "duplicate entries in laravel"

Browse Popular Code Answers by Language