Update StoryController, fix postgres bug

pull/1936/head
Daniel Supernault 2020-01-14 21:50:05 -07:00
rodzic b0fd75f4c2
commit 8360aa4827
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 0DEF1C662C9033F7
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -104,11 +104,12 @@ class StoryController extends Controller
$profile = $request->user()->profile;
$following = $profile->following->pluck('id')->toArray();
$groupBy = config('database.default') == 'pgsql' ? 'id' : 'profile_id';
$stories = Story::with('profile')
->whereIn('profile_id', $following)
->where('expires_at', '>', now())
->groupBy('profile_id')
->groupBy($groupBy)
->orderByDesc('expires_at')
->take(9)
->get()