/**
  * @param array $payload
  * @return static
  */
 public function createItem(array $payload)
 {
     $item = $this->item->newInstance($payload);
     $item->sort = $this->item->where('menu_id', $payload['menu_id'])->whereNull('parent_id')->count();
     $item->save();
     if ($item) {
         $item->load($this->itemRelations());
         return $item;
     }
 }
 /**
  * @param $model
  */
 public function handle($model)
 {
     if ($model instanceof MenuHookable) {
         //find the menu item
         if ($model instanceof Page) {
             $items = MenuItem::where('page_id', $model->id)->get();
         }
         $translations = $model->getMenuLocalisedNames();
         foreach ($items as $item) {
             //foreach locale, see if the translation in the menu item is set
             //if not, update the item with the data from the menu hookable item
             $payload = [];
             foreach ($this->account->locales as $locale) {
                 $translation = $item->translateOrNew($locale->slug);
                 if (empty($translation->name)) {
                     $payload[$locale->slug] = ['name' => $translations[$locale->slug]];
                 }
             }
             $this->menu->updateItem($item, $payload);
         }
     }
 }