InflowResource::collection($this->resource['inflows']), 'outflows' => OutflowResource::collection($this->resource['outflows']), 'draws' => DrawResource::collection($this->resource['draws']), 'summary' => [ 'total_inflow' => $this->resource['inflows']->sum('amount_currency'), 'total_outflow' => $this->resource['outflows']->sum('amount_currency'), 'total_allocated' => $this->resource['draws']->sum('amount_currency'), 'net_cashflow' => $this->resource['inflows']->sum('amount_currency') - $this->resource['outflows']->sum('amount_currency'), ], ]; } }