fix logo display issue

This commit is contained in:
raishvaria
2021-01-15 14:22:42 +05:30
parent 8eeafd3fed
commit 9c5e9e56f5
4 changed files with 12 additions and 32 deletions

View File

@ -22,10 +22,17 @@ class Company extends Model implements HasMedia
public function getLogoAttribute()
{
$logo = $this->getMedia('logo')->first();
$isSystem = FileDisk::whereSetAsDefault(true)->first()->isSystem();
if ($logo) {
return asset($logo->getUrl());
if ($isSystem) {
return $logo->getPath();
} else {
return $logo->getFullUrl();
}
return ;
}
return null;
}
public function user()

View File

@ -428,16 +428,7 @@ class Estimate extends Model implements HasMedia
$estimateTemplate = EstimateTemplate::find($this->estimate_template_id);
$company = Company::find($this->company_id);
$logo = $company->getMedia('logo')->first();
$isSystem = FileDisk::whereSetAsDefault(true)->first()->isSystem();
$isLocalhost = config('session.domain') === 'localhost';
if ($logo && $isLocalhost && $isSystem) {
$logo = $logo->getPath();
} else if ($logo) {
$logo = $logo->getFullUrl();
}
$logo = $company->logo;
view()->share([
'estimate' => $this,

View File

@ -512,16 +512,7 @@ class Invoice extends Model implements HasMedia
$company = Company::find($this->company_id);
$logo = $company->getMedia('logo')->first();
$isSystem = FileDisk::whereSetAsDefault(true)->first()->isSystem();
$isLocalhost = config('session.domain') === 'localhost';
if ($logo && $isLocalhost && $isSystem) {
$logo = $logo->getPath();
} else if ($logo) {
$logo = $logo->getFullUrl();
}
$logo = $company->logo;
view()->share([
'invoice' => $this,

View File

@ -373,16 +373,7 @@ class Payment extends Model implements HasMedia
{
$company = Company::find($this->company_id);
$logo = $company->getMedia('logo')->first();
$isSystem = FileDisk::whereSetAsDefault(true)->first()->isSystem();
$isLocalhost = config('session.domain') === 'localhost';
if ($logo && $isLocalhost && $isSystem) {
$logo = $logo->getPath();
} else if($logo) {
$logo = $logo->getFullUrl();
}
$logo = $company->logo;
view()->share([
'payment' => $this,