In my scenario, I go along the following route:
model/{model}/edit
and I'm looking at the route:
model/{model}/duplicate
I make a copy of the model and save it
$duplicate_model = $model->replicate();
$duplicate_model->save();
after that I want to go back to editing the route of the new model, doing something in accordance with this:
return redirect()->back()->with('model' => $duplicate_model);
hoping that it will replace the model identifier with the model of the duplicated model, but this is not so.
I cannot access a specific route, because there are different cases in which you can access a duplicate route.
source
share