events and hooks

This commit is contained in:
2024-10-09 13:47:03 +03:00
parent b208e79d15
commit c3e6f9ff64
12 changed files with 111 additions and 40 deletions
+8 -4
View File
@@ -2,18 +2,22 @@
namespace Lucent\Revision\Listener;
use Lucent\Edge\Event\EdgesUpdated;
use Lucent\Record\Event\RecordCreated;
use Lucent\Record\Event\RecordUpdated;
use Lucent\Revision\RevisionService;
class CreateRevision
{
public function __construct()
public function __construct(
private RevisionService $revisionService
)
{
}
public function handle(EdgesUpdated $event): void
public function handle(RecordCreated|RecordUpdated $event): void
{
$this->revisionService->create($event->record, $event->edges);
}
}