I am trying to achieve something very simple. I have a datatable and I am allowing users to create clone of a record and open it in edit mode.
My controller is as below.
public function clone($id)
{
$inventory=Inventory::find($id)->replicate();
$inventory->save();
return $this->edit($inventory->$id);
}
I was hoping to get the id of the cloned record from $inventory->$id
, but it still gives me old id. But when I check in DB its generating a new id.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire