From 16b3725185c38859657904c2c83695912867362a Mon Sep 17 00:00:00 2001 From: Patrick Carlo-Hickman Date: Tue, 3 Jan 2017 08:59:16 -0500 Subject: [PATCH] Update read/unread notification relationships to build off base relationship. (#17093) --- .../Notifications/HasDatabaseNotifications.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Illuminate/Notifications/HasDatabaseNotifications.php b/src/Illuminate/Notifications/HasDatabaseNotifications.php index a09e9b85bd31..0b938b01fa01 100644 --- a/src/Illuminate/Notifications/HasDatabaseNotifications.php +++ b/src/Illuminate/Notifications/HasDatabaseNotifications.php @@ -18,9 +18,8 @@ public function notifications() */ public function readNotifications() { - return $this->morphMany(DatabaseNotification::class, 'notifiable') - ->whereNotNull('read_at') - ->orderBy('created_at', 'desc'); + return $this->notifications() + ->whereNotNull('read_at'); } /** @@ -28,8 +27,7 @@ public function readNotifications() */ public function unreadNotifications() { - return $this->morphMany(DatabaseNotification::class, 'notifiable') - ->whereNull('read_at') - ->orderBy('created_at', 'desc'); + return $this->notifications() + ->whereNull('read_at'); } }