I am working on laravel 5.3 and i have to store a duplicate row from table here is my function and i am getting following error Call to a member function replicate() on null please help me to fix it function
public function copy($id){
$task = Task::find(1);
$newTask = $task->replicate();
$newTask->save();
}