this seems to work

This commit is contained in:
spencerrlongg 2023-10-17 13:30:51 -05:00
parent 82c2a46ada
commit 277608d962
2 changed files with 10 additions and 10 deletions

View file

@ -92,6 +92,10 @@ class Setting extends Model
'google_client_secret', 'google_client_secret',
]; ];
protected $casts = [
'label2_asset_logo' => 'boolean',
];
/** /**
* Get the app settings. * Get the app settings.
* Cache is expired on Setting model saved in EventServiceProvider. * Cache is expired on Setting model saved in EventServiceProvider.

View file

@ -103,19 +103,15 @@ class Label implements View
$logo = null; $logo = null;
// Should we be trying to use a logo at all? // 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='1') { if ($settings->label2_asset_logo && $asset->company && $asset->company->image!='') {
$logo = Storage::disk('public')->path('companies/'.e($asset->company->image));
// If we don't have a company image, fall back to the general site label image }
else {
// Use the general site label logo, if available
if (!empty($settings->label_logo)) { if (!empty($settings->label_logo)) {
$logo = Storage::disk('public')->path('/'.e($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)) { if (!empty($logo)) {