src/Label305/AujaLaravel/Factory/AssociationMenuFactory.php
public function create($modelName, $modelId, $associationName, ModelConfig $config = null) {
        $menu = new Menu();

        $addMenuItem = new LinkMenuItem();
        $addMenuItem->setText(Lang::trans('Add') . ' ' . Lang::trans($associationName));
        $addMenuItem->setIcon(Icons::ion_plus);
        $addMenuItem->setTarget(Url::route($this->aujaRouter->getCreateAssociationName($modelName, $associationName), $modelId));
        $menu->addMenuItem($addMenuItem);

        $headerMenuItem = new SpacerMenuItem();
        $headerMenuItem->setText(Lang::trans(str_plural($associationName)));
        $menu->addMenuItem($headerMenuItem);

        $resourceMenuItem = new ResourceMenuItem();
        $resourceMenuItem->setTarget(Url::route($this->aujaRouter->getAssociationName($modelName, $associationName), $modelId));
        $menu->addMenuItem($resourceMenuItem);

        return $menu;
    }
public function create($modelName, $modelId, $associationName, ModelConfig $config = null) {
        $menu = new Menu();

        $addMenuItem = new LinkMenuItem();
        $addMenuItem->setText(Lang::trans('Add') . ' ' . Lang::trans($associationName));
        $addMenuItem->setIcon(Icons::ion_plus);
        $addMenuItem->setTarget(Url::route($this->aujaRouter->getCreateAssociationName($modelName, $associationName), $modelId));
        $menu->addMenuItem($addMenuItem);

        $headerMenuItem = new SpacerMenuItem();
        $headerMenuItem->setText(Lang::trans(str_plural($associationName)));
        $menu->addMenuItem($headerMenuItem);

        $resourceMenuItem = new ResourceMenuItem();
        $resourceMenuItem->setTarget(Url::route($this->aujaRouter->getAssociationName($modelName, $associationName), $modelId));
        $menu->addMenuItem($resourceMenuItem);

        return $menu;
    }
Builds a menu for displaying associated items to a model entry (i.e. /club/21/team).

The menu will include:
- An Add LinkMenuItem;
- A SpacerMenuItem with the name of the associated model;
- A ResourceMenuItem to hold entries of the associated model.

@param String      $modelName       The name of the model (i.e. Club).
@param int         $modelId         The id of the model entry.
@param String      $associationName The name of the associated model (i.e. Team).
@param ModelConfig $config          (optional) The `ModelConfig` to use.

@return Menu the Menu, which can be configured further.