mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-28 01:41:14 -06:00
move 7c78708
logic from transformer to controller
This commit is contained in:
parent
7c78708865
commit
16a511cf79
@ -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;
|
||||
|
@ -83,8 +83,7 @@ class BillTransformer extends AbstractTransformer
|
||||
'skip' => (int)$bill->skip,
|
||||
'active' => $bill->active,
|
||||
'notes' => $notes,
|
||||
'next_expected_match' => $paidData['next_expected_match']->format('Y-m-d'),
|
||||
'next_expected_match_diff'=> $paidData['next_expected_match']->isToday() ? trans('firefly.today') : $paidData['next_expected_match']->diffForHumans(Carbon::today(), Carbon::DIFF_RELATIVE_TO_NOW),
|
||||
'next_expected_match' => $paidData['next_expected_match'],
|
||||
'pay_dates' => $payDates,
|
||||
'paid_dates' => $paidData['paid_dates'],
|
||||
'links' => [
|
||||
@ -217,7 +216,7 @@ class BillTransformer extends AbstractTransformer
|
||||
}
|
||||
$result = [
|
||||
'paid_dates' => $result,
|
||||
'next_expected_match' => $nextMatch,
|
||||
'next_expected_match' => $nextMatch->format('Y-m-d'),
|
||||
];
|
||||
Log::debug('Result', $result);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user