Skip to content

Commit 24b6c97

Browse files
committed
feat: add expoNotifications relation in trait for notifiable class
1 parent 842ec74 commit 24b6c97

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/Traits/HasManyExpoToken.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace YieldStudio\LaravelExpoNotifier\Traits;
66

77
use Illuminate\Database\Eloquent\Relations\MorphMany;
8+
use YieldStudio\LaravelExpoNotifier\Models\ExpoNotification;
89
use YieldStudio\LaravelExpoNotifier\Models\ExpoToken;
910

1011
trait HasManyExpoToken
@@ -13,4 +14,9 @@ public function expoTokens(): MorphMany
1314
{
1415
return $this->morphMany(ExpoToken::class, 'owner');
1516
}
17+
18+
public function expoNotifications(): MorphMany
19+
{
20+
return $this->morphMany(ExpoNotification::class, 'receiver');
21+
}
1622
}

src/Traits/HasUniqueExpoToken.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
namespace YieldStudio\LaravelExpoNotifier\Traits;
66

7+
use Illuminate\Database\Eloquent\Relations\MorphMany;
78
use Illuminate\Database\Eloquent\Relations\MorphOne;
9+
use YieldStudio\LaravelExpoNotifier\Models\ExpoNotification;
810
use YieldStudio\LaravelExpoNotifier\Models\ExpoToken;
911

1012
trait HasUniqueExpoToken
@@ -13,4 +15,9 @@ public function expoTokens(): MorphOne
1315
{
1416
return $this->morphOne(ExpoToken::class, 'owner');
1517
}
18+
19+
public function expoNotifications(): MorphMany
20+
{
21+
return $this->morphMany(ExpoNotification::class, 'receiver');
22+
}
1623
}

0 commit comments

Comments
 (0)