[CLEAR-38] order by created

This commit is contained in:
Artur Nowakowski 2020-01-19 17:40:34 +01:00
parent d176703b00
commit 36e6cd575c

View File

@ -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) {