public function boot()
 {
     // App::register( 'Laravelrus\LocalizedCarbon\LocalizedCarbonServiceProvider' );
     $alias = AliasLoader::getInstance();
     // $alias->alias( 'LocalizedCarbon', 'Laravelrus\LocalizedCarbon\LocalizedCarbon' );
     // $alias->alias( 'DiffFormatter'  , 'Laravelrus\LocalizedCarbon\DiffFactoryFacade' );
     $alias->alias('Carbon', '\\Carbon\\Carbon');
     $alias->alias('CW', '\\Clockwork\\Support\\Laravel\\Facade');
     /*
      * Register menu items for the RainLab.Pages plugin
      */
     Event::listen('pages.menuitem.listTypes', function () {
         return ['repertoire' => 'Репертуар', 'troupe' => 'Труппа', 'playbill' => 'Афиша'];
     });
     Event::listen('pages.menuitem.getTypeInfo', function ($type) {
         if ($type == 'repertoire') {
             return PerformanceModel::getMenuTypeInfo($type);
         }
         if ($type == 'troupe') {
             return PersonModel::getMenuTypeInfo($type);
         }
         if ($type == 'playbill') {
             return EventModel::getMenuTypeInfo($type);
         }
     });
     Event::listen('pages.menuitem.resolveItem', function ($type, $item, $url, $theme) {
         if ($type == 'repertoire') {
             return PerformanceModel::resolveMenuItem($item, $url, $theme);
         }
         if ($type == 'troupe') {
             return PersonModel::resolveMenuItem($item, $url, $theme);
         }
         if ($type == 'playbill') {
             return EventModel::resolveMenuItem($item, $url, $theme);
         }
     });
 }
 protected function listPosts()
 {
     $params = $this->params;
     /*
      * List all posts
      */
     $posts = EventModel::listFrontEnd($params);
     /*
      * Prepare for View
      */
     $active = Carbon::now();
     $posts->each(function ($post) use($params, &$active) {
         // Assign URLs
         extract($params);
         // if ($post->relation instanceof ArticleModel)
         //     $post->relation->setUrl($newsPage, $this->controller);
         if ($post->relation instanceof PerformanceModel) {
             $post->relation->setUrl($performancePage, $this->controller);
         }
         $date = Carbon::parse($post->event_date);
         if ($active != 'active' && $date->gte($active)) {
             $post->active = $active = 'active';
         }
         // Grouping
         if ($this->inCollection($post->relation->taxonomy, 'title', 'Детские спектакли')) {
             $this->group['child'][] = $post;
         } else {
             $this->group['normal'][] = $post;
         }
     });
     // CW::info($this->group);
     CW::info(['Events' => $posts]);
     return $posts;
 }