From 3014a2284984eb99da476a378cb411b3a666f131 Mon Sep 17 00:00:00 2001 From: Ben Cole Date: Fri, 29 May 2015 10:57:03 -0700 Subject: [PATCH] Wrap @foreach in conditional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If $invoiceLabels was not set, an invalid argument error was being thrown on the page “/company/advanced_settings/invoice_design” --- resources/views/accounts/invoice_design.blade.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/resources/views/accounts/invoice_design.blade.php b/resources/views/accounts/invoice_design.blade.php index 13efe002ecf7..d14a70e75a93 100644 --- a/resources/views/accounts/invoice_design.blade.php +++ b/resources/views/accounts/invoice_design.blade.php @@ -85,9 +85,11 @@ {!! Former::populate($account) !!} {!! Former::populateField('hide_quantity', intval($account->hide_quantity)) !!} {!! Former::populateField('hide_paid_to_date', intval($account->hide_paid_to_date)) !!} - @foreach ($invoiceLabels as $field => $value) - {!! Former::populateField("labels_{$field}", $value) !!} - @endforeach + @if ($invoiceLabels) + @foreach ($invoiceLabels as $field => $value) + {!! Former::populateField("labels_{$field}", $value) !!} + @endforeach + @endif