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

        $addMenuItem = new LinkMenuItem();
        $addMenuItem->setText(Lang::trans('Add'));
        $addMenuItem->setIcon(Icons::ion_plus);
        $addMenuItem->setTarget(URL::route($this->aujaRouter->getCreateName($modelName)));
        $menu->addMenuItem($addMenuItem);

        $spacerMenuItem = new SpacerMenuItem();
        $spacerMenuItem->setText(Lang::trans($modelName));
        $menu->addMenuItem($spacerMenuItem);

        $resourceMenuItem = new ResourceMenuItem();
        $resourceMenuItem->setTarget(URL::route($this->aujaRouter->getIndexName($modelName)));

        $model = $this->aujaConfigurator->getModel($modelName);
        if($this->aujaConfigurator->isSearchable($model, $config)){
            $target = urldecode(URL::route($this->aujaRouter->getIndexName($modelName), ['q' => '%s'])); /* urldecode because the '%' gets escaped. */
            $property = new Searchable($target);
            $resourceMenuItem->addProperty($property);
        }

        $menu->addMenuItem($resourceMenuItem);

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

        $addMenuItem = new LinkMenuItem();
        $addMenuItem->setText(Lang::trans('Add'));
        $addMenuItem->setIcon(Icons::ion_plus);
        $addMenuItem->setTarget(URL::route($this->aujaRouter->getCreateName($modelName)));
        $menu->addMenuItem($addMenuItem);

        $spacerMenuItem = new SpacerMenuItem();
        $spacerMenuItem->setText(Lang::trans($modelName));
        $menu->addMenuItem($spacerMenuItem);

        $resourceMenuItem = new ResourceMenuItem();
        $resourceMenuItem->setTarget(URL::route($this->aujaRouter->getIndexName($modelName)));

        $model = $this->aujaConfigurator->getModel($modelName);
        if($this->aujaConfigurator->isSearchable($model, $config)){
            $target = urldecode(URL::route($this->aujaRouter->getIndexName($modelName), ['q' => '%s'])); /* urldecode because the '%' gets escaped. */
            $property = new Searchable($target);
            $resourceMenuItem->addProperty($property);
        }

        $menu->addMenuItem($resourceMenuItem);

        return $menu;
    }
public function create ( $ modelName , ModelConfig $ config = null ) { $ menu = new Menu ( ) ; $ addMenuItem = new LinkMenuItem ( ) ; $ addMenuItem -> setText ( Lang :: trans ( 'Add' ) ) ; $ addMenuItem -> setIcon ( Icons :: ion_plus ) ; $ addMenuItem -> setTarget ( URL :: route ( $ this -> aujaRouter -> getCreateName ( $ modelName ) ) ) ; $ menu -> addMenuItem ( $ addMenuItem ) ; $ spacerMenuItem = new SpacerMenuItem ( ) ; $ spacerMenuItem -> setText ( Lang :: trans ( $ modelName ) ) ; $ menu -> addMenuItem ( $ spacerMenuItem ) ; $ resourceMenuItem = new ResourceMenuItem ( ) ; $ resourceMenuItem -> setTarget ( URL :: route ( $ this -> aujaRouter -> getIndexName ( $ modelName ) ) ) ; $ model = $ this -> aujaConfigurator -> getModel ( $ modelName ) ; if ( $ this -> aujaConfigurator -> isSearchable ( $ model , $ config ) ) { $ target = urldecode ( URL :: route ( $ this -> aujaRouter -> getIndexName ( $ modelName ) , [ 'q' => '%s' ] ) ) ; /* urldecode because the '%' gets escaped. */ $ property = new Searchable ( $ target ) ; $ resourceMenuItem -> addProperty ( $ property ) ; } $ menu -> addMenuItem ( $ resourceMenuItem ) ; return $ menu ; }
Builds a simple menu for given model, where typically this model should not have any relations to other models.

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

@param String      $modelName The name of the model.
@param ModelConfig $config    (optional) The `ModelConfig` to use.

@return Menu the Menu, which can be configured further.
Builds a simple menu for given model where typically this model should not have any relations to other models .