From 212880640dedf124940c3e402d864a64a926fc54 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Fri, 14 Aug 2015 12:51:30 +0930 Subject: [PATCH] Support table custom table prefix Laravel automatically adds a table prefix to any table names, so we need to wrap our aliased table in DB::raw. --- src/Core/Notifications/NotificationRepository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core/Notifications/NotificationRepository.php b/src/Core/Notifications/NotificationRepository.php index b19e2860a..5c92699eb 100644 --- a/src/Core/Notifications/NotificationRepository.php +++ b/src/Core/Notifications/NotificationRepository.php @@ -26,9 +26,9 @@ class NotificationRepository ->skip($offset) ->take($limit); - return Notification::select('notifications.*', 'p.unread_count') + return Notification::select('notifications.*', app('flarum.db')->raw('p.unread_count')) ->mergeBindings($primaries->getQuery()) - ->join(app('flarum.db')->raw('('.$primaries->toSql().') p'), 'notifications.id', '=', 'p.id') + ->join(app('flarum.db')->raw('('.$primaries->toSql().') p'), 'notifications.id', '=', app('flarum.db')->raw('p.id')) ->latest('time') ->get(); }