morphMany(DatabaseNotification::class, 'notifiable') ->orderBy('created_at', 'desc'); } /** * Get the entity's read notifications. */ public function readNotifications() { return $this->notifications() ->whereNotNull('read_at'); } /** * Get the entity's unread notifications. */ public function unreadNotifications() { return $this->notifications() ->whereNull('read_at'); } }