lthn.io/app/Core/Activity/Boot.php
Claude 41a90cbff8
feat: lthn.io API serving live chain data
Fixed: basePath self→static binding, namespace detection, event wiring,
SQLite cache, file cache driver. All Mod Boot classes converted to
$listens pattern for lifecycle event discovery.

Working endpoints:
- /v1/explorer/info — live chain height, difficulty, aliases
- /v1/explorer/stats — formatted chain statistics
- /v1/names/directory — alias directory grouped by type
- /v1/names/available/{name} — name availability check
- /v1/names/lookup/{name} — name details

Co-Authored-By: Charon <charon@lethean.io>
2026-04-03 17:17:42 +01:00

79 lines
1.8 KiB
PHP

<?php
/*
* Core PHP Framework
*
* Licensed under the European Union Public Licence (EUPL) v1.2.
* See LICENSE file for details.
*/
declare(strict_types=1);
namespace Core\Activity;
use Core\Activity\Console\ActivityPruneCommand;
use Core\Activity\Services\ActivityLogService;
use Core\Activity\View\Modal\Admin\ActivityFeed;
use Core\Events\AdminPanelBooting;
use Core\Events\ConsoleBooting;
use Livewire\Livewire;
/**
* Activity module boot class.
*
* Registers activity logging features with the Core PHP framework:
* - Console commands (activity:prune)
* - Livewire components (ActivityFeed)
* - Service bindings
*
* The module uses the spatie/laravel-activitylog package with
* workspace-aware enhancements.
*/
class Boot
{
public static array $listens = [
ConsoleBooting::class => 'onConsole',
AdminPanelBooting::class => 'onAdmin',
];
/**
* Register console commands.
*/
public function onConsole(ConsoleBooting $event): void
{
if (! $this->isEnabled()) {
return;
}
$event->command(ActivityPruneCommand::class);
}
/**
* Register admin panel components and routes.
*/
public function onAdmin(AdminPanelBooting $event): void
{
if (! $this->isEnabled()) {
return;
}
// Register view namespace
$event->views('core.activity', __DIR__.'/View/Blade');
// Register Livewire component (only if Livewire is available)
if (app()->bound('livewire')) {
Livewire::component('core.activity-feed', ActivityFeed::class);
}
// Bind service as singleton
app()->singleton(ActivityLogService::class);
}
/**
* Check if activity logging is enabled.
*/
protected function isEnabled(): bool
{
return config('core.activity.enabled', true);
}
}