mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-29 12:14:34 -06:00
Some improved sorting.
This commit is contained in:
parent
6900392e43
commit
c9fff197f7
@ -8,6 +8,7 @@ use FireflyIII\Http\Requests\TagFormRequest;
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Input;
|
||||
use Preferences;
|
||||
use Response;
|
||||
@ -184,7 +185,16 @@ class TagController extends Controller
|
||||
// loop each types and get the tags, group them by year.
|
||||
$collection = [];
|
||||
foreach ($types as $type) {
|
||||
|
||||
/** @var Collection $tags */
|
||||
$tags = Auth::user()->tags()->where('tagMode', $type)->orderBy('date', 'ASC')->get();
|
||||
|
||||
$tags = $tags->sortBy(
|
||||
function (Tag $tag) {
|
||||
return strtolower($tag->tag);
|
||||
}
|
||||
);
|
||||
|
||||
/** @var Tag $tag */
|
||||
foreach ($tags as $tag) {
|
||||
$year = is_null($tag->date) ? trans('firefly.no_year') : $tag->date->year;
|
||||
|
@ -62,9 +62,16 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
|
||||
*/
|
||||
public function getActiveBudgets()
|
||||
{
|
||||
$budgets = Auth::user()->budgets()->where('active', 1)->get();
|
||||
/** @var Collection $set */
|
||||
$set = Auth::user()->budgets()->where('active', 1)->get();
|
||||
|
||||
return $budgets;
|
||||
$set = $set->sortBy(
|
||||
function (Budget $budget) {
|
||||
return strtolower($budget->name);
|
||||
}
|
||||
);
|
||||
|
||||
return $set;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,7 +153,16 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
|
||||
*/
|
||||
public function getInactiveBudgets()
|
||||
{
|
||||
return Auth::user()->budgets()->where('active', 0)->get();
|
||||
/** @var Collection $set */
|
||||
$set = Auth::user()->budgets()->where('active', 0)->get();
|
||||
|
||||
$set = $set->sortBy(
|
||||
function (Budget $budget) {
|
||||
return strtolower($budget->name);
|
||||
}
|
||||
);
|
||||
|
||||
return $set;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ class CategoryRepository extends ComponentRepository implements CategoryReposito
|
||||
$set = Auth::user()->categories()->orderBy('name', 'ASC')->get();
|
||||
$set = $set->sortBy(
|
||||
function (Category $category) {
|
||||
return $category->name;
|
||||
return strtolower($category->name);
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -112,7 +112,7 @@ class TagRepository implements TagRepositoryInterface
|
||||
$tags = Auth::user()->tags()->get();
|
||||
$tags = $tags->sortBy(
|
||||
function (Tag $tag) {
|
||||
return $tag->tag;
|
||||
return strtolower($tag->tag);
|
||||
}
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user