Some improved sorting.

This commit is contained in:
James Cole
2015-07-08 13:11:51 +02:00
parent 6900392e43
commit c9fff197f7
4 changed files with 31 additions and 5 deletions

View File

@@ -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;