Implement creator studio and upload updates

This commit is contained in:
2026-04-04 10:12:02 +02:00
parent 1da7d3bf88
commit 0b216b7ecd
15107 changed files with 31206 additions and 626514 deletions

View File

@@ -0,0 +1,52 @@
<?php
declare(strict_types=1);
namespace App\Services\Sitemaps\Builders;
use App\Services\Sitemaps\AbstractSitemapBuilder;
use App\Services\Sitemaps\GoogleNewsSitemapUrl;
use DateTimeInterface;
use cPad\Plugins\News\Models\NewsArticle;
final class GoogleNewsSitemapBuilder extends AbstractSitemapBuilder
{
public function name(): string
{
return (string) \config('sitemaps.news.google_variant_name', 'news-google');
}
public function items(): array
{
return NewsArticle::query()
->published()
->where('published_at', '>=', now()->subHours(max(1, (int) \config('sitemaps.news.google_lookback_hours', 48))))
->orderByDesc('published_at')
->limit(max(1, (int) \config('sitemaps.news.google_max_items', 1000)))
->get()
->map(function (NewsArticle $article): ?GoogleNewsSitemapUrl {
if (trim((string) $article->slug) === '' || $article->published_at === null) {
return null;
}
return new GoogleNewsSitemapUrl(
route('news.show', ['slug' => $article->slug]),
trim((string) $article->title),
$article->published_at,
(string) \config('sitemaps.news.google_publication_name', 'Skinbase Nova'),
(string) \config('sitemaps.news.google_language', 'en'),
);
})
->filter(fn (?GoogleNewsSitemapUrl $item): bool => $item !== null && $item->title !== '')
->values()
->all();
}
public function lastModified(): ?DateTimeInterface
{
return $this->dateTime(NewsArticle::query()
->published()
->where('published_at', '>=', now()->subHours(max(1, (int) \config('sitemaps.news.google_lookback_hours', 48))))
->max('published_at'));
}
}