From 277608d962be2b82abcf12a67a9602afe101cc3d Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Tue, 17 Oct 2023 13:30:51 -0500 Subject: [PATCH 1/2] this seems to work --- app/Models/Setting.php | 4 ++++ app/View/Label.php | 16 ++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 6c95d6b01..caf142cbd 100755 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -92,6 +92,10 @@ class Setting extends Model 'google_client_secret', ]; + protected $casts = [ + 'label2_asset_logo' => 'boolean', + ]; + /** * Get the app settings. * Cache is expired on Setting model saved in EventServiceProvider. diff --git a/app/View/Label.php b/app/View/Label.php index d581548eb..50b9d3a97 100644 --- a/app/View/Label.php +++ b/app/View/Label.php @@ -103,19 +103,15 @@ class Label implements View $logo = null; - // Should we be trying to use a logo at all? - if ($settings->label2_asset_logo='1') { - - // If we don't have a company image, fall back to the general site label image + // Should we use the assets assigned company logo? (A.K.A. "Is `Labels > Use Asset Logo` enabled?"), and do we have a company logo? + if ($settings->label2_asset_logo && $asset->company && $asset->company->image!='') { + $logo = Storage::disk('public')->path('companies/'.e($asset->company->image)); + } + else { + // Use the general site label logo, if available if (!empty($settings->label_logo)) { $logo = Storage::disk('public')->path('/'.e($settings->label_logo)); } - - // If we have a company logo, use that first - if (($asset->company) && ($asset->company->image!='')) { - $logo = Storage::disk('public')->path('companies/'.e($asset->company->image)); - } - } if (!empty($logo)) { From 4bdd070f7b7d55b29f89a7167a07760711633075 Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Tue, 17 Oct 2023 13:41:31 -0500 Subject: [PATCH 2/2] formatting --- app/View/Label.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/View/Label.php b/app/View/Label.php index 50b9d3a97..83184e4b0 100644 --- a/app/View/Label.php +++ b/app/View/Label.php @@ -106,12 +106,9 @@ class Label implements View // Should we use the assets assigned company logo? (A.K.A. "Is `Labels > Use Asset Logo` enabled?"), and do we have a company logo? if ($settings->label2_asset_logo && $asset->company && $asset->company->image!='') { $logo = Storage::disk('public')->path('companies/'.e($asset->company->image)); - } - else { + } elseif (!empty($settings->label_logo)) { // Use the general site label logo, if available - if (!empty($settings->label_logo)) { - $logo = Storage::disk('public')->path('/'.e($settings->label_logo)); - } + $logo = Storage::disk('public')->path('/'.e($settings->label_logo)); } if (!empty($logo)) {