public function collectSiteMapItems()
    {
        $itemCollection = [];
        $modules = config('site-mapped-modules', [
            'blog' => 'Grafite\Cms\Repositories\BlogRepository',
            'page' => 'Grafite\Cms\Repositories\PageRepository',
            'events' => 'Grafite\Cms\Repositories\EventRepository',
        ]);

        foreach ($modules as $module => $repository) {
            try {
                $items = collect([]);

                if (method_exists($repository, 'arePublic')) {
                    $items = app($repository)->arePublic();
                }

                foreach ($items as $item) {
                    $itemCollection[] = [
                        'url' => url($module.'/'.$item->url),
                        'updated_at' => $item->updated_at->format('Y-m-d'),
                    ];
                }
            } catch (ReflectionException $e) {
                // It just means we couldn't find
                // the Repository class
            }
        }

        return collect($itemCollection);
    }
public function collectSiteMapItems()
    {
        $itemCollection = [];
        $modules = config('site-mapped-modules', [
            'blog' => 'Grafite\Cms\Repositories\BlogRepository',
            'page' => 'Grafite\Cms\Repositories\PageRepository',
            'events' => 'Grafite\Cms\Repositories\EventRepository',
        ]);

        foreach ($modules as $module => $repository) {
            try {
                $items = collect([]);

                if (method_exists($repository, 'arePublic')) {
                    $items = app($repository)->arePublic();
                }

                foreach ($items as $item) {
                    $itemCollection[] = [
                        'url' => url($module.'/'.$item->url),
                        'updated_at' => $item->updated_at->format('Y-m-d'),
                    ];
                }
            } catch (ReflectionException $e) {
                // It just means we couldn't find
                // the Repository class
            }
        }

        return collect($itemCollection);
    }
public function collectSiteMapItems ( ) { $ itemCollection = [ ] ; $ modules = config ( 'site-mapped-modules' , [ 'blog' => 'Grafite\Cms\Repositories\BlogRepository' , 'page' => 'Grafite\Cms\Repositories\PageRepository' , 'events' => 'Grafite\Cms\Repositories\EventRepository' , ] ) ; foreach ( $ modules as $ module => $ repository ) { try { $ items = collect ( [ ] ) ; if ( method_exists ( $ repository , 'arePublic' ) ) { $ items = app ( $ repository ) -> arePublic ( ) ; } foreach ( $ items as $ item ) { $ itemCollection [ ] = [ 'url' => url ( $ module . '/' . $ item -> url ) , 'updated_at' => $ item -> updated_at -> format ( 'Y-m-d' ) , ] ; } } catch ( ReflectionException $ e ) { // It just means we couldn't find // the Repository class } } return collect ( $ itemCollection ) ; }
Collect items for a site map

@return array
Collect items for a site map