From 94076e5b9ce11e62dc3abb9b844be669eec7af21 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. --- .../core/src/Core/Notifications/NotificationRepository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/core/src/Core/Notifications/NotificationRepository.php b/framework/core/src/Core/Notifications/NotificationRepository.php index b19e2860a..5c92699eb 100644 --- a/framework/core/src/Core/Notifications/NotificationRepository.php +++ b/framework/core/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(); }