Пример #1
0
 /**
  * @param Menu $menu
  * @param MenuItem $item
  * @return
  */
 public function destroy(Menu $menu, MenuItem $item)
 {
     //make sure to load the relationships, so we can use them to make that type of resource available again.
     //example: when deleting a menuitem refering to a page,
     //we need to make the page available again in the UI.
     //if we load it, before deleting, the page object will be there in the response.
     $item->load(['page', 'page.translations', 'route', 'route.translations']);
     return $this->menu->deleteItem($item);
 }
Пример #2
0
 /**
  * @param MenuItem $item
  * @param array $payload
  * @return MenuItem
  */
 public function updateItem(MenuItem $item, array $payload)
 {
     $item->load('translations');
     $item->fill($payload);
     $item->save();
     return $item;
 }