From e80ca435bb43bf3391427c7d482367d97eaea3e6 Mon Sep 17 00:00:00 2001 From: Mehmet Faruk Demirkoparan Date: Fri, 16 Aug 2024 17:12:21 +0300 Subject: [PATCH] - getEventMetadata function added to EventableModelContract --- src/Contracts/EventableModelContract.php | 5 +++++ src/Models/Eventable.php | 5 +++++ src/Traits/HasEvents.php | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/src/Contracts/EventableModelContract.php b/src/Contracts/EventableModelContract.php index c49b4ea..eb33b79 100644 --- a/src/Contracts/EventableModelContract.php +++ b/src/Contracts/EventableModelContract.php @@ -69,4 +69,9 @@ public function scopeAllEventInstances( ): EventInstanceDTOCollection; public function scopeAuthorized(Builder $query): void; + + /** + * @return array + */ + public function getEventMetadata(): array; } diff --git a/src/Models/Eventable.php b/src/Models/Eventable.php index 97426ae..52bd7bf 100644 --- a/src/Models/Eventable.php +++ b/src/Models/Eventable.php @@ -43,4 +43,9 @@ public function scopeAuthorized(Builder $query): void { $query->where('name', '=', 'event701'); } + + public function getEventMetadata(): array + { + return ['key' => $this->name]; + } } diff --git a/src/Traits/HasEvents.php b/src/Traits/HasEvents.php index 6e5e1dc..5e4cbad 100644 --- a/src/Traits/HasEvents.php +++ b/src/Traits/HasEvents.php @@ -450,4 +450,9 @@ public function scopeAllEventInstances( } public function scopeAuthorized(Builder $query): void {} + + public function getEventMetadata(): array + { + return ['key' => 'value']; + } }