src/Gzero/Cms/Listeners/BlockLoad.php
public function handleLaravelRoute(RouteMatched $event)
    {
        if ($this->isValidFrontendRoute($event)) {
            ViewComposer::addCallback(function () use ($event) {
                $blockIds = $this->blockFinder->getBlocksIds($event->route->getName(), true);
                $blocks   = $this->blockRepository->getVisibleBlocks($blockIds, $this->languageService->getCurrent(), true);
                $this->handleBlockRendering($blocks);
                $blocks = $blocks->groupBy('region');
                view()->share('blocks', $blocks);
            });
        }
    }
public function handleLaravelRoute(RouteMatched $event)
    {
        if ($this->isValidFrontendRoute($event)) {
            ViewComposer::addCallback(function () use ($event) {
                $blockIds = $this->blockFinder->getBlocksIds($event->route->getName(), true);
                $blocks   = $this->blockRepository->getVisibleBlocks($blockIds, $this->languageService->getCurrent(), true);
                $this->handleBlockRendering($blocks);
                $blocks = $blocks->groupBy('region');
                view()->share('blocks', $blocks);
            });
        }
    }
public function handleLaravelRoute ( RouteMatched $ event ) { if ( $ this -> isValidFrontendRoute ( $ event ) ) { ViewComposer :: addCallback ( function ( ) use ( $ event ) { $ blockIds = $ this -> blockFinder -> getBlocksIds ( $ event -> route -> getName ( ) , true ) ; $ blocks = $ this -> blockRepository -> getVisibleBlocks ( $ blockIds , $ this -> languageService -> getCurrent ( ) , true ) ; $ this -> handleBlockRendering ( $ blocks ) ; $ blocks = $ blocks -> groupBy ( 'region' ) ; view ( ) -> share ( 'blocks' , $ blocks ) ; } ) ; } }
Handle the event. It loads block for static named routes.

@param RouteMatched $event dispatched event

@return void
Handle the event . It loads block for static named routes .