Wire admin studio SSR and search infrastructure

This commit is contained in:
2026-05-01 11:46:06 +02:00
parent 257b0dbef6
commit 18cea8b0f0
329 changed files with 197465 additions and 2741 deletions

View File

@@ -5,9 +5,9 @@ declare(strict_types=1);
namespace App\Http\Controllers\Web;
use App\Http\Controllers\Controller;
use App\Models\World;
use App\Services\Worlds\WorldService;
use App\Support\Seo\SeoFactory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;
@@ -32,16 +32,47 @@ final class WorldController extends Controller
]))->rootView('collections');
}
public function show(Request $request, World $world): Response
public function show(Request $request, string $world): Response|RedirectResponse
{
abort_unless($world->isPubliclyVisible(), 404);
$resolution = $this->worlds->resolvePublicWorld($world);
$resolvedWorld = $resolution['world'] ?? null;
$payload = $this->worlds->publicShowPayload($world, $request->user());
abort_unless($resolvedWorld !== null, 404);
if (! empty($resolution['redirect'])) {
return redirect()->to((string) $resolution['redirect'], 301);
}
$payload = $this->worlds->publicShowPayload($resolvedWorld, $request->user());
$seo = app(SeoFactory::class)->collectionPage(
$world->seo_title ?: ($world->title . ' — Skinbase Nova'),
$world->seo_description ?: ($world->summary ?: $world->description ?: 'Seasonal and editorial discovery world on Skinbase Nova.'),
route('worlds.show', ['world' => $world->slug]),
$world->ogImageUrl(),
$resolvedWorld->seo_title ?: ($resolvedWorld->title . ' — Skinbase Nova'),
$resolvedWorld->seo_description ?: ($resolvedWorld->summary ?: $resolvedWorld->description ?: 'Seasonal and editorial discovery world on Skinbase Nova.'),
$this->worlds->canonicalPublicUrl($resolvedWorld),
$resolvedWorld->ogImageUrl(),
)->toArray();
return Inertia::render('World/WorldShow', array_merge($payload, [
'seo' => $seo,
]))->rootView('collections');
}
public function showEdition(Request $request, string $world, int $year): Response|RedirectResponse
{
$resolution = $this->worlds->resolvePublicEdition($world, $year);
$resolvedWorld = $resolution['world'] ?? null;
abort_unless($resolvedWorld !== null, 404);
if (! empty($resolution['redirect'])) {
return redirect()->to((string) $resolution['redirect'], 301);
}
$payload = $this->worlds->publicShowPayload($resolvedWorld, $request->user());
$seo = app(SeoFactory::class)->collectionPage(
$resolvedWorld->seo_title ?: ($resolvedWorld->title . ' — Skinbase Nova'),
$resolvedWorld->seo_description ?: ($resolvedWorld->summary ?: $resolvedWorld->description ?: 'Seasonal and editorial discovery world on Skinbase Nova.'),
$this->worlds->canonicalPublicUrl($resolvedWorld),
$resolvedWorld->ogImageUrl(),
)->toArray();
return Inertia::render('World/WorldShow', array_merge($payload, [