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

@@ -14,7 +14,7 @@ final class ArtworkDraftService
public function createDraft(int $userId, string $title, ?string $description, ?int $categoryId = null, bool $isMature = false): ArtworkDraftResult
{
return DB::transaction(function () use ($userId, $title, $description, $categoryId, $isMature) {
$slug = $this->uniqueSlug($title);
$slug = $this->makeSlug($title);
$artwork = Artwork::create([
'user_id' => $userId,
@@ -44,20 +44,10 @@ final class ArtworkDraftService
});
}
private function uniqueSlug(string $title): string
private function makeSlug(string $title): string
{
$base = Str::slug($title);
$base = $base !== '' ? $base : 'artwork';
for ($i = 0; $i < 5; $i++) {
$suffix = Str::lower(Str::random(6));
$slug = Str::limit($base . '-' . $suffix, 160, '');
if (! Artwork::where('slug', $slug)->exists()) {
return $slug;
}
}
return Str::limit($base . '-' . Str::uuid()->toString(), 160, '');
return Str::limit($base !== '' ? $base : 'artwork', 160, '');
}
}