Modules\Sections\Module::registerRoute PHP Method

registerRoute() public method

public registerRoute ( )
    public function registerRoute()
    {
        $sections = Sections::getAllGlobalActive()->keyBy('id')->toArray();
        if (empty($sections)) {
            return;
        }
        foreach ($sections as $section) {
            $url = array_filter(explode(\App\Models\Sections::PATH_DELIMITER, $section['path']));
            foreach ($url as &$id) {
                $id = $sections[$id]['code'];
            }
            $url[-1] = '';
            $url[] = $section['code'];
            ksort($url);
            $url = implode(\App\Models\Sections::PATH_DELIMITER, $url);
            PageRouteCollection::add(new PageResource($url . '/', 'sectionAction', 's' . $section['id']));
            PageRouteCollection::add(new PageResource($url . '/{pageCode}', 'detailAction', 'sp' . $section['id']));
        }
    }