events and hooks
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user