Skip to content

Commit

Permalink
Fix notification query with DB prefix
Browse files Browse the repository at this point in the history
This was fixed in laravel/framework#28400.
See commit 7f10483.
  • Loading branch information
franzliedke committed May 9, 2020
1 parent 220c8c6 commit 5dc9451
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Notification/NotificationRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

use Carbon\Carbon;
use Flarum\User\User;
use Illuminate\Database\Query\Expression;

class NotificationRepository
{
Expand All @@ -36,11 +35,8 @@ public function findByUser(User $user, $limit = null, $offset = 0)
->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();
}
Expand Down

0 comments on commit 5dc9451

Please sign in to comment.