/**
  * register group
  *
  * @param null|array $group
  * @param array|string $action
  */
 protected function registerGroup($group = null, $action = [])
 {
     if ($group !== null) {
         $this->group = $group['action'];
     } elseif (is_array($action) && isset($action['_group'])) {
         $groups = RouteCollector::getGroups();
         $group = $action['_group'];
         $this->group = isset($groups[$group]) ? $groups[$group] : null;
     }
 }
Exemple #2
0
 /**
  * resolve the when collections
  *
  * @param array $groups
  * @return array return the new collections
  */
 private function resolveGroupCollections(array $groups = [])
 {
     foreach ($groups as $index => $group) {
         // register group
         RouteCollector::$firing['group'] = $group;
         app()->call($group['callback'], [app('route')]);
         // unregister the route
         unset(RouteCollector::$firing['group']);
         RouteCollector::removeGroup($index);
     }
     return RouteCollector::getRoutes();
 }