Implement creator studio and upload updates
This commit is contained in:
47
app/Services/Sitemaps/Builders/CollectionsSitemapBuilder.php
Normal file
47
app/Services/Sitemaps/Builders/CollectionsSitemapBuilder.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Services\Sitemaps\Builders;
|
||||
|
||||
use App\Models\Collection;
|
||||
use App\Services\Sitemaps\SitemapUrl;
|
||||
use App\Services\Sitemaps\SitemapUrlBuilder;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
final class CollectionsSitemapBuilder extends AbstractIdShardableSitemapBuilder
|
||||
{
|
||||
public function __construct(private readonly SitemapUrlBuilder $urls)
|
||||
{
|
||||
}
|
||||
|
||||
public function name(): string
|
||||
{
|
||||
return 'collections';
|
||||
}
|
||||
|
||||
protected function shardConfigKey(): string
|
||||
{
|
||||
return 'collections';
|
||||
}
|
||||
|
||||
protected function mapRecord(Model $record): ?SitemapUrl
|
||||
{
|
||||
return $this->urls->collection($record);
|
||||
}
|
||||
|
||||
protected function query(): Builder
|
||||
{
|
||||
return Collection::query()
|
||||
->with('user:id,username')
|
||||
->public()
|
||||
->whereNull('canonical_collection_id')
|
||||
->orderBy('id');
|
||||
}
|
||||
|
||||
protected function qualifiedIdColumn(): string
|
||||
{
|
||||
return 'collections.id';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user