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.
This commit is contained in:
Toby Zerner 2015-08-14 12:51:30 +09:30
parent 4d164d2e55
commit 94076e5b9c

View File

@ -26,9 +26,9 @@ class NotificationRepository
->skip($offset) ->skip($offset)
->take($limit); ->take($limit);
return Notification::select('notifications.*', 'p.unread_count') return Notification::select('notifications.*', app('flarum.db')->raw('p.unread_count'))
->mergeBindings($primaries->getQuery()) ->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') ->latest('time')
->get(); ->get();
} }