AspireCloud/app/Observers/ElasticSearchObserver.php
2025-10-24 16:30:22 -06:00

29 lines
534 B
PHP

<?php
declare(strict_types=1);
namespace App\Observers;
use App\Models\WpOrg\Plugin;
use App\Services\Elastic\IndexService;
readonly class ElasticSearchObserver
{
public function __construct(private IndexService $index) {}
public function created(Plugin $plugin): void
{
$this->index->add($plugin);
}
public function updated(Plugin $plugin): void
{
$this->index->add($plugin);
}
public function deleted(Plugin $plugin): void
{
$this->index->remove($plugin);
}
}