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
68 lines
1.8 KiB
PHP
68 lines
1.8 KiB
PHP
<?php
|
|
|
|
// SPDX-License-Identifier: EUPL-1.2
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Core\Mod\Agentic\Mod\Admin\Search;
|
|
|
|
use Illuminate\Contracts\Support\Arrayable;
|
|
use JsonSerializable;
|
|
|
|
final class SearchResult implements Arrayable, JsonSerializable
|
|
{
|
|
/**
|
|
* @param array<string, mixed> $metadata
|
|
*/
|
|
public function __construct(
|
|
public readonly string $id,
|
|
public readonly string $type,
|
|
public readonly string $title,
|
|
public readonly string $description,
|
|
public readonly string $url,
|
|
public readonly string $icon,
|
|
public readonly array $metadata = [],
|
|
) {}
|
|
|
|
/**
|
|
* @param array<string, mixed> $data
|
|
*/
|
|
public static function fromArray(array $data): self
|
|
{
|
|
return new self(
|
|
id: (string) ($data['id'] ?? uniqid('search_', true)),
|
|
type: (string) ($data['type'] ?? 'unknown'),
|
|
title: (string) ($data['title'] ?? ''),
|
|
description: (string) ($data['description'] ?? $data['subtitle'] ?? ''),
|
|
url: (string) ($data['url'] ?? '#'),
|
|
icon: (string) ($data['icon'] ?? 'document'),
|
|
metadata: (array) ($data['metadata'] ?? $data['meta'] ?? []),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'type' => $this->type,
|
|
'title' => $this->title,
|
|
'description' => $this->description,
|
|
'subtitle' => $this->description,
|
|
'url' => $this->url,
|
|
'icon' => $this->icon,
|
|
'metadata' => $this->metadata,
|
|
'meta' => $this->metadata,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function jsonSerialize(): array
|
|
{
|
|
return $this->toArray();
|
|
}
|
|
}
|