public function addSubItem(array $subItem, $autoUpdate = true) { $subItem = new CartSubItem($subItem); $this->subItems[$subItem->getHash()] = $subItem; $this->generateHash(); if ($autoUpdate) { app('laracart')->update(); } return $subItem; }