From 36e6cd575c63606164ffe031e0ec85e14d96919f Mon Sep 17 00:00:00 2001 From: Artur Nowakowski Date: Sun, 19 Jan 2020 17:40:34 +0100 Subject: [PATCH] [CLEAR-38] order by created --- api/app/Repositories/UsersRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/app/Repositories/UsersRepository.php b/api/app/Repositories/UsersRepository.php index 19ff62d..385e0b8 100644 --- a/api/app/Repositories/UsersRepository.php +++ b/api/app/Repositories/UsersRepository.php @@ -49,7 +49,7 @@ class UsersRepository implements UsersRepositoryInterface public function getRecipeHistory(int $userID, string $groupBy = 'day') { - $userRecipes = UsersRecipes::where('user_id', $userID)->get(); + $userRecipes = UsersRecipes::where('user_id', $userID)->orderByDesc('created_at')->get(); $recipeHistory = []; if ($groupBy == 'month') { $userRecipes = $userRecipes->groupBy(function ($d) {