costUnits->getById($costUnitId); $estimates = $this->estimates->getEstimates($costUnit, $estimateType); return response()->json([ 'status' => 'success', 'costUnitId' => $costUnitId, 'title' => InvoiceType::where('slug', $estimateType)->first()->name, 'estimateType' => $estimateType, 'estimates' => $estimates, 'totalAmountString' => $this->estimates->getTotalAmount($costUnit, $estimateType)->toString(), ]); } }