formatApiResponse($api->getTrendingMovies(1, 500), false)['data']; $shows = $this->formatApiResponse($api->getTrendingShows(1, 500), false)['data']; foreach ($movies as $key => $movie) { if ($movie['slug'] === '') continue; $sitemap->addItem(route('movie', ['id' => $movie['id'], 'slug' => $movie['slug']]), time(), Sitemap::DAILY, 0.9); } foreach ($shows as $key => $show) { if ($show['slug'] === '') continue; $sitemap->addItem(route('show', ['id' => $show['id'], 'slug' => $show['slug']]), time(), Sitemap::DAILY, 0.9); } $sitemap->write(); // dd($movies); } }