Foundation slice for Mantis #843 php/Mod/Admin + php/Website/Hub RFC: * php/Mod/Admin/Boot.php — search registry, menu registry, form component layer, HasRateLimiting concern, reusable form/view primitives under Mod/Admin/Forms * php/Website/Hub/Boot.php — host-aware Hub route naming for secondary domains * WorkspaceSwitcher and GlobalSearch global Hub Livewire components * Foundation routed slice in Hub/Routes/admin.php: dashboard shell, workspace listing, site settings (with WordPress/webhook connector), account usage, platform user list+detail * Foundation tests under php/tests/Feature/Mod/Admin/ 53 PHP files. php -l clean. Pest unrunnable in sandbox (no vendor/). Foundation slice only — composer.json kept off-limits so namespace stays under Core\Mod\Agentic\... rather than standalone Core\Admin package. Deferred: Profile, Settings, ServiceManager, ServicesAdmin, Honeypot, Entitlement\{Dashboard,FeatureManager,PackageManager}, PromptManager, WaitlistManager, Console, Databases, Deployments, Content, ContentManager, ContentEditor, ActivityLog, Analytics, AIServices, BoostPurchase. Lane was under-instructed by supervisor with stop-at framing — follow-up tickets needed for remainder. Co-authored-by: Codex <noreply@openai.com> Closes tasks.lthn.sh/view.php?id=843
46 lines
1 KiB
PHP
46 lines
1 KiB
PHP
<?php
|
|
|
|
// SPDX-License-Identifier: EUPL-1.2
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Core\Mod\Agentic\Website\Hub\Support;
|
|
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
final class HubRouteNames
|
|
{
|
|
public static function prefix(?string $host = null): string
|
|
{
|
|
$host ??= request()->getHost();
|
|
|
|
if ($host === null || $host === '') {
|
|
return 'hub.';
|
|
}
|
|
|
|
if ((bool) preg_match('/^core\.(test|localhost)$/', $host)) {
|
|
return 'hub.';
|
|
}
|
|
|
|
return str_replace('.', '_', $host).'.';
|
|
}
|
|
|
|
public static function name(string $suffix, ?string $host = null): string
|
|
{
|
|
return self::prefix($host).$suffix;
|
|
}
|
|
|
|
/**
|
|
* @param array<string, mixed> $parameters
|
|
*/
|
|
public static function url(string $suffix, array $parameters = [], ?string $fallback = null, ?string $host = null): string
|
|
{
|
|
$name = self::name($suffix, $host);
|
|
|
|
if (Route::has($name)) {
|
|
return route($name, $parameters);
|
|
}
|
|
|
|
return $fallback ?? '#';
|
|
}
|
|
}
|