Merge branch 'logo-issue' into 'master'

fix logo display issue

See merge request mohit.panjvani/crater-web!664
This commit is contained in:
Mohit Panjwani
2021-01-15 10:16:28 +00:00
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,