Skip to content

Commit

Permalink
use static for logo
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Oct 5, 2023
1 parent 410dfc9 commit 6fb520c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
10 changes: 9 additions & 1 deletion app/Abstracts/View/Components/Documents/Show.php
Expand Up @@ -940,6 +940,12 @@ protected function getLogo($logo)
return $logo;
}

static $content;

if (! empty($content)) {
return $content;
}

$media_id = (! empty($this->document->contact->logo) && ! empty($this->document->contact->logo->id)) ? $this->document->contact->logo->id : setting('company.logo');

$media = Media::find($media_id);
Expand Down Expand Up @@ -985,7 +991,9 @@ protected function getLogo($logo)

$extension = File::extension($path);

return 'data:image/' . $extension . ';base64,' . base64_encode($image);
$content = 'data:image/' . $extension . ';base64,' . base64_encode($image);

return $content;
}

protected function getBackgroundColor($type, $backgroundColor)
Expand Down
10 changes: 9 additions & 1 deletion app/Abstracts/View/Components/Documents/Template.php
Expand Up @@ -220,6 +220,12 @@ protected function getLogo($logo)
return $logo;
}

static $content;

if (! empty($content)) {
return $content;
}

$media_id = (! empty($this->document->contact->logo) && ! empty($this->document->contact->logo->id)) ? $this->document->contact->logo->id : setting('company.logo');

$media = Media::find($media_id);
Expand Down Expand Up @@ -265,7 +271,9 @@ protected function getLogo($logo)

$extension = File::extension($path);

return 'data:image/' . $extension . ';base64,' . base64_encode($image);
$content = 'data:image/' . $extension . ';base64,' . base64_encode($image);

return $content;
}

protected function getBackgroundColor($type, $backgroundColor)
Expand Down
10 changes: 9 additions & 1 deletion app/Abstracts/View/Components/Transactions/Show.php
Expand Up @@ -499,6 +499,12 @@ protected function getLogo($logo)
return $logo;
}

static $content;

if (! empty($content)) {
return $content;
}

$media_id = (!empty($this->transaction->contact->logo) && !empty($this->transaction->contact->logo->id)) ? $this->transaction->contact->logo->id : setting('company.logo');

$media = Media::find($media_id);
Expand Down Expand Up @@ -544,7 +550,9 @@ protected function getLogo($logo)

$extension = File::extension($path);

return 'data:image/' . $extension . ';base64,' . base64_encode($image);
$content = 'data:image/' . $extension . ';base64,' . base64_encode($image);

return $content;
}

protected function getRouteButtonAddNew($type, $routeButtonAddNew)
Expand Down
10 changes: 9 additions & 1 deletion app/Abstracts/View/Components/Transactions/Template.php
Expand Up @@ -269,6 +269,12 @@ protected function getLogo($logo)
return $logo;
}

static $content;

if (! empty($content)) {
return $content;
}

$media_id = (!empty($this->transaction->contact->logo) && !empty($this->transaction->contact->logo->id)) ? $this->transaction->contact->logo->id : setting('company.logo');

$media = Media::find($media_id);
Expand Down Expand Up @@ -314,7 +320,9 @@ protected function getLogo($logo)

$extension = File::extension($path);

return 'data:image/' . $extension . ';base64,' . base64_encode($image);
$content = 'data:image/' . $extension . ';base64,' . base64_encode($image);

return $content;
}

protected function getTextContentTitle($type, $textContentTitle)
Expand Down

0 comments on commit 6fb520c

Please sign in to comment.