mirror of
https://gh.wpcy.net/https://github.com/aspirepress/AspireCloud.git
synced 2026-06-01 00:19:09 +08:00
29 lines
534 B
PHP
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);
|
|
}
|
|
}
|