How to use multiple sitemaps with sitemap index

// sitemap with posts
Route::get('sitemap-posts', function()
{
    // create sitemap
    $sitemap_posts = App::make("sitemap");

    // set cache
    $sitemap_posts->setCache('laravel.sitemap-posts', 3600);

    // add items
    $posts = DB::table('posts')->orderBy('created_at', 'desc')->get();

    foreach ($posts as $post)
    {
        $sitemap_posts->add($post->slug, $post->modified, $post->priority, $post->freq);
    }

    // show sitemap
    return $sitemap_posts->render('xml');
});
// sitemap with tags
Route::get('sitemap-tags', function()
{
    // create sitemap
    $sitemap_tags = App::make("sitemap");

    // set cache
    $sitemap_tags->setCache('laravel.sitemap-tags', 3600);

    // add items
    $tags = DB::table('tags')->get();

    foreach ($tags as $tag)
    {
        $sitemap_tags->add($tag->slug, null, '0.5', 'weekly');
    }

    // show sitemap
    return $sitemap_tags->render('xml');
});
// sitemap index
Route::get('sitemap', function()
{
    // create sitemap
    $sitemap = App::make("sitemap");

    // set cache
    $sitemap->setCache('laravel.sitemap-index', 3600);

    // add sitemaps (loc, lastmod (optional))
    $sitemap->addSitemap(URL::to('sitemap-posts'));
    $sitemap->addSitemap(URL::to('sitemap-tags'));

    // show sitemap
    return $sitemap->render('sitemapindex');
});

Chapter 4 of 6