<?php
 namespace App\Services\Menu\Adapters; use Illuminate\Support\Facades\Route; class RouteAdapter implements LinkAdapter { public function resolve(array $linkTarget, string $locale, array $context = []): ?string { $name = $linkTarget['route'] ?? null; if (! $name || ! Route::has($name)) { return null; } $localized = $name . '.' . $locale; if (Route::has($localized)) { $name = $localized; } try { return route($name, $linkTarget['params'] ?? []); } catch (\Throwable $e) { return null; } } public function isValid(array $linkTarget): bool { $name = $linkTarget['route'] ?? null; return is_string($name) && Route::has($name); } public function searchable(): bool { return false; } } 