code: protected function active(array $nav)
      {
          // check if each item is active
          foreach ($nav as $key => $value) {
              // check if it is local
              if (isset($value['slug'])) {
                  // if the request starts with the slug
                  if ($this->request->is($value['slug']) || $this->request->is($value['slug'].'/*')) {
                      // then the navigation item is active, or selected
                      $nav[$key]['active'] = true;
                  } else {
                      // then the navigation item is not active or selected
                      $nav[$key]['active'] = false;
                  }
              } else {
                  // then the navigation item is not active or selected
                  $nav[$key]['active'] = false;
              }
          }
  
          // spit out the nav bar array at the end
          return $nav;
      }
docs: Check if each item is active.
  
  @param array $nav
  
  @return array