I can't fetch last id of created data from related model.
I tried to use $alacarte->id
but it doesnt get the right ID of the model.
$order = array(
'os_id' => $orderSlip->id,
'group_id' => $menu['group_id'],
'size' => $menu['size'],
);
$alacarte = $this->menu->find($menu['id']);
$alacarte->orders()->create($order)->save();
return $alacarte->id;
I expect the output of the last created order to be the ID of Model\Order
, but the actual output is the ID of the Model\Menu
.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire