diff --git a/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php b/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php index f4697394db..d94c91cb40 100644 --- a/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php +++ b/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php @@ -74,8 +74,8 @@ class BudgetLimitEnrichment implements EnrichmentInterface private function collectIds(): void { - $this->start = $this->collection->min('start_date'); - $this->end = $this->collection->max('end_date'); + $this->start = $this->collection->min('start_date') ?? Carbon::now()->startOfMonth(); + $this->end = $this->collection->max('end_date') ?? Carbon::now()->endOfMonth(); /** @var BudgetLimit $limit */ foreach ($this->collection as $limit) { diff --git a/app/Transformers/CategoryTransformer.php b/app/Transformers/CategoryTransformer.php index dd4cd73c55..0891522887 100644 --- a/app/Transformers/CategoryTransformer.php +++ b/app/Transformers/CategoryTransformer.php @@ -79,8 +79,11 @@ class CategoryTransformer extends AbstractTransformer ]; } - private function beautify(array $array): array + private function beautify(?array $array): ?array { + if(null === $array) { + return null; + } $return = []; foreach ($array as $data) { $data['sum'] = Steam::bcround($data['sum'], (int)$data['currency_decimal_places']);