From 1b29624716c10cc9871e8c492603bd006d939cc2 Mon Sep 17 00:00:00 2001 From: Quentin Gabriele Date: Fri, 17 May 2024 18:39:49 +0200 Subject: [PATCH] fix loop null data --- phpstan.neon.dist | 1 - resources/views/default.blade.php | 28 ++++++++++++++-------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index a91953b..260b5e1 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -10,5 +10,4 @@ parameters: tmpDir: build/phpstan checkOctaneCompatibility: true checkModelProperties: true - checkMissingIterableValueType: false diff --git a/resources/views/default.blade.php b/resources/views/default.blade.php index ce8f299..d9a0aae 100644 --- a/resources/views/default.blade.php +++ b/resources/views/default.blade.php @@ -195,7 +195,7 @@ - - + @if ($invoice->due_at) - + @@ -218,7 +218,7 @@ @endif @if ($invoice->paid_at) - + @@ -271,7 +271,7 @@ @if ($company_number = data_get($invoice->seller, 'company_number'))

{{ $company_number }}

@endif - @foreach (data_get($invoice->seller, 'data', []) as $key => $item) + @foreach (data_get($invoice->seller, 'data') ?? [] as $key => $item) @if (is_string($key))

{{ $key }}: {{ $item }}

@else @@ -310,7 +310,7 @@ @if ($company_number = data_get($invoice->buyer, 'company_number'))

{{ $company_number }}

@endif - @foreach (data_get($invoice->buyer, 'data', []) as $key => $item) + @foreach (data_get($invoice->buyer, 'data') ?? [] as $key => $item) @if (is_string($key))

{{ $key }}: {{ $item }}

@else @@ -384,9 +384,9 @@ {{-- empty space --}} - - @@ -395,13 +395,13 @@ {{-- empty space --}} - - @@ -411,10 +411,10 @@ {{-- empty space --}} - - @@ -422,10 +422,10 @@ {{-- empty space --}} - -
+ {{ __('invoices::invoice.serial_number') }} @@ -203,14 +203,14 @@
{{ __('invoices::invoice.created_at') }}{{ __('invoices::invoice.created_at') }} {{ $invoice->created_at?->format(config('invoices.date_format')) }}
{{ __('invoices::invoice.due_at') }}{{ __('invoices::invoice.due_at') }} {{ $invoice->due_at->format(config('invoices.date_format')) }}
{{ __('invoices::invoice.paid_at') }}{{ __('invoices::invoice.paid_at') }} {{ $invoice->paid_at->format(config('invoices.date_format')) }}
+ {{ __('invoices::invoice.subtotal_amount') }} + {{ $invoice->formatMoney($invoice->subTotalAmount()) }}
+ {{ __($discount->name) ?? __('invoices::invoice.discount_name') }} @if ($discount->percent_off) ({{ $discount->formatPercentage($discount->percent_off) }}) @endif + {{ $invoice->formatMoney($discount->computeDiscountAmountOn($invoice->subTotalAmount())?->multipliedBy(-1)) }}
+ {{ $invoice->tax_label ?? __('invoices::invoice.tax_label') }} + {{ $invoice->formatMoney($invoice->totalTaxAmount()) }}
+ {{ __('invoices::invoice.total_amount') }} + {{ $invoice->formatMoney($invoice->totalAmount()) }}