1
0
mirror of https://github.com/flarum/core.git synced 2025-07-16 14:26:25 +02:00

Fix notification query with DB prefix

This was fixed in https://github.com/laravel/framework/pull/28400.
See commit 7f1048352d.
This commit is contained in:
Franz Liedke
2020-05-09 14:45:57 +02:00
parent 220c8c66b0
commit 5dc9451c21

View File

@@ -11,7 +11,6 @@ namespace Flarum\Notification;
use Carbon\Carbon;
use Flarum\User\User;
use Illuminate\Database\Query\Expression;
class NotificationRepository
{
@@ -36,11 +35,8 @@ class NotificationRepository
->skip($offset)
->take($limit);
return Notification::select('notifications.*')
->selectRaw('p.unread_count')
// Expression is necessary until Laravel 5.8.
// See https://github.com/laravel/framework/pull/28400
->joinSub($primaries, 'p', 'notifications.id', '=', new Expression('p.id'))
return Notification::select('notifications.*', 'p.unread_count')
->joinSub($primaries, 'p', 'notifications.id', '=', 'p.id')
->latest()
->get();
}