fix company logo issue

This commit is contained in:
Mohit Panjwani
2021-01-22 19:00:37 +05:30
parent b7370ed85c
commit 7b95ccb5fc
4 changed files with 23 additions and 10 deletions

View File

@ -1,4 +1,5 @@
<?php
namespace Crater\Models;
use Crater\Models\Address;
@ -17,9 +18,9 @@ class Company extends Model implements HasMedia
protected $fillable = ['name', 'logo', 'unique_hash'];
protected $appends=['logo'];
protected $appends = ['logo', 'logo_path'];
public function getLogoAttribute()
public function getLogoPathAttribute()
{
$logo = $this->getMedia('logo')->first();
@ -28,10 +29,22 @@ class Company extends Model implements HasMedia
if ($logo) {
if ($isSystem) {
return $logo->getPath();
} else {
} else {
return $logo->getFullUrl();
}
}
return null;
}
public function getLogoAttribute()
{
$logo = $this->getMedia('logo')->first();
if ($logo) {
return $logo->getFullUrl();
}
return null;
}

View File

@ -426,7 +426,7 @@ class Estimate extends Model implements HasMedia
$estimateTemplate = EstimateTemplate::find($this->estimate_template_id);
$company = Company::find($this->company_id);
$logo = $company->logo;
$logo = $company->logo_path;
view()->share([
'estimate' => $this,

View File

@ -510,7 +510,7 @@ class Invoice extends Model implements HasMedia
$company = Company::find($this->company_id);
$logo = $company->logo;
$logo = $company->logo_path;
view()->share([
'invoice' => $this,

View File

@ -216,10 +216,10 @@ class Payment extends Model implements HasMedia
}
$payment = Payment::with([
'user',
'invoice',
'paymentMethod',
])
'user',
'invoice',
'paymentMethod',
])
->find($this->id);
return $payment;
@ -373,7 +373,7 @@ class Payment extends Model implements HasMedia
{
$company = Company::find($this->company_id);
$logo = $company->logo;
$logo = $company->logo_path;
view()->share([
'payment' => $this,