move 7c78708 logic from transformer to controller

This commit is contained in:
Florian Dupret
2020-06-16 18:02:48 +02:00
parent 7c78708865
commit 16a511cf79
2 changed files with 4 additions and 3 deletions

View File

@@ -212,6 +212,8 @@ class BillController extends Controller
$bills = $unfiltered->map(
function (Bill $bill) use ($transformer, $defaultCurrency) {
$return = $transformer->transform($bill);
$nextExpectedMatch = new Carbon($return['next_expected_match']);
$return['next_expected_match_diff'] = $nextExpectedMatch->isToday() ? trans('firefly.today') : $nextExpectedMatch->diffForHumans(today(), Carbon::DIFF_RELATIVE_TO_NOW);
$currency = $bill->transactionCurrency ?? $defaultCurrency;
$return['currency_id'] = $currency->id;
$return['currency_name'] = $currency->name;