Caffeinated\Menus\Builder::getLastGroupPrefix PHP Method

getLastGroupPrefix() public method

Get the prefix from the last group of the stack.
public getLastGroupPrefix ( ) : mixed
return mixed
    public function getLastGroupPrefix()
    {
        if (count($this->groupStack) > 0) {
            return array_get(last($this->groupStack), 'prefix', '');
        }
        return null;
    }

Usage Example

Beispiel #1
0
 /**
  * Configures the link for the menu item.
  *
  * @param  array|string  $options
  * @return null
  */
 public function configureLink($options)
 {
     if (!is_array($options)) {
         $path = ['url' => $options];
     } elseif (isset($options['raw']) and $options['raw'] == true) {
         $path = null;
     } else {
         $path = array_only($options, ['url', 'route', 'action', 'secure']);
     }
     if (!is_null($path)) {
         $path['prefix'] = $this->builder->getLastGroupPrefix();
     }
     $this->link = isset($path) ? new Link($path) : null;
     $this->checkActiveStatus();
 }