Example #1
0
 /**
  * Delete menu item
  *
  * @param MenuItem $item item instance
  * @return bool|null
  * @throws CanNotDeleteMenuItemHaveChildException
  */
 public function removeItem(MenuItem $item)
 {
     if ($item->getDescendantCount() > 0) {
         throw new CanNotDeleteMenuItemHaveChildException();
     }
     $item->ancestors()->detach($item);
     $this->destroyMenuType($item);
     return $this->repo->deleteItem($item);
 }