Save workspace changes

This commit is contained in:
2026-04-18 17:02:56 +02:00
parent f02ea9a711
commit 87d60af5a9
4220 changed files with 1388603 additions and 1554 deletions

View File

@@ -5,6 +5,7 @@ use App\Services\Maturity\ArtworkMaturityService;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Http\Resources\MissingValue;
use App\Services\ThumbnailService;
use Illuminate\Support\Str;
class ArtworkListResource extends JsonResource
{
@@ -53,12 +54,16 @@ class ArtworkListResource extends JsonResource
$slugVal = $get('slug');
$hash = (string) ($get('hash') ?? '');
$thumbExt = (string) ($get('thumb_ext') ?? '');
$canonicalSlug = Str::slug((string) ($slugVal ?: $get('title') ?: 'artwork'));
if ($canonicalSlug === '') {
$canonicalSlug = (string) ($get('id') ?? 'artwork');
}
$webUrl = $contentTypeSlug && $categoryPath && $slugVal
? '/' . strtolower($contentTypeSlug) . '/' . strtolower($categoryPath) . '/' . $slugVal
: null;
$artId = $get('id');
$directUrl = $artId && $slugVal ? '/art/' . $artId . '/' . $slugVal : null;
$directUrl = $artId ? '/art/' . $artId . '/' . $canonicalSlug : null;
$decode = static fn (?string $v): string => html_entity_decode((string) ($v ?? ''), ENT_QUOTES | ENT_HTML5, 'UTF-8');
@@ -102,10 +107,11 @@ class ArtworkListResource extends JsonResource
'content_type_name' => $decode($contentTypeName),
'url' => $webUrl,
] : null,
'canonical_url' => $directUrl,
'urls' => [
'web' => $webUrl ?? $directUrl,
'direct' => $directUrl,
'canonical' => $webUrl ?? $directUrl,
'canonical' => $directUrl ?? $webUrl,
],
], $this->resource, $request->user());
}