Answers for "laravel how to do duplicate with all relationship"

PHP
3

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 "laravel how to do duplicate with all relationship"

Browse Popular Code Answers by Language