mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Order categories by name.
This commit is contained in:
parent
25d1d1be1b
commit
9c8ba66873
@ -46,7 +46,15 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
*/
|
||||
public function getCategories()
|
||||
{
|
||||
return Auth::user()->categories()->orderBy('name', 'ASC')->get();
|
||||
/** @var Collection $set */
|
||||
$set = Auth::user()->categories()->orderBy('name', 'ASC')->get();
|
||||
$set->sortBy(
|
||||
function (Category $category) {
|
||||
return $category->name;
|
||||
}
|
||||
);
|
||||
|
||||
return $set;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -167,6 +175,17 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
return floatval($category->transactionjournals()->before($end)->after($start)->lessThan(0)->sum('amount')) * -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function spentOnDaySum(Category $category, Carbon $date)
|
||||
{
|
||||
return floatval($category->transactionjournals()->onDate($date)->lessThan(0)->sum('amount')) * -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
@ -199,15 +218,4 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
|
||||
return $category;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function spentOnDaySum(Category $category, Carbon $date)
|
||||
{
|
||||
return floatval($category->transactionjournals()->onDate($date)->lessThan(0)->sum('amount')) * -1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user