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.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3wyvnWR
via IFTTT
Aucun commentaire:
Enregistrer un commentaire