mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 19:51:09 -04:00
fix company logo issue
This commit is contained in:
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Crater\Models;
|
namespace Crater\Models;
|
||||||
|
|
||||||
use Crater\Models\Address;
|
use Crater\Models\Address;
|
||||||
@ -17,9 +18,9 @@ class Company extends Model implements HasMedia
|
|||||||
|
|
||||||
protected $fillable = ['name', 'logo', 'unique_hash'];
|
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();
|
$logo = $this->getMedia('logo')->first();
|
||||||
|
|
||||||
@ -28,10 +29,22 @@ class Company extends Model implements HasMedia
|
|||||||
if ($logo) {
|
if ($logo) {
|
||||||
if ($isSystem) {
|
if ($isSystem) {
|
||||||
return $logo->getPath();
|
return $logo->getPath();
|
||||||
} else {
|
} else {
|
||||||
return $logo->getFullUrl();
|
return $logo->getFullUrl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLogoAttribute()
|
||||||
|
{
|
||||||
|
$logo = $this->getMedia('logo')->first();
|
||||||
|
|
||||||
|
if ($logo) {
|
||||||
|
return $logo->getFullUrl();
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -426,7 +426,7 @@ class Estimate extends Model implements HasMedia
|
|||||||
$estimateTemplate = EstimateTemplate::find($this->estimate_template_id);
|
$estimateTemplate = EstimateTemplate::find($this->estimate_template_id);
|
||||||
|
|
||||||
$company = Company::find($this->company_id);
|
$company = Company::find($this->company_id);
|
||||||
$logo = $company->logo;
|
$logo = $company->logo_path;
|
||||||
|
|
||||||
view()->share([
|
view()->share([
|
||||||
'estimate' => $this,
|
'estimate' => $this,
|
||||||
|
|||||||
@ -510,7 +510,7 @@ class Invoice extends Model implements HasMedia
|
|||||||
|
|
||||||
$company = Company::find($this->company_id);
|
$company = Company::find($this->company_id);
|
||||||
|
|
||||||
$logo = $company->logo;
|
$logo = $company->logo_path;
|
||||||
|
|
||||||
view()->share([
|
view()->share([
|
||||||
'invoice' => $this,
|
'invoice' => $this,
|
||||||
|
|||||||
@ -216,10 +216,10 @@ class Payment extends Model implements HasMedia
|
|||||||
}
|
}
|
||||||
|
|
||||||
$payment = Payment::with([
|
$payment = Payment::with([
|
||||||
'user',
|
'user',
|
||||||
'invoice',
|
'invoice',
|
||||||
'paymentMethod',
|
'paymentMethod',
|
||||||
])
|
])
|
||||||
->find($this->id);
|
->find($this->id);
|
||||||
|
|
||||||
return $payment;
|
return $payment;
|
||||||
@ -373,7 +373,7 @@ class Payment extends Model implements HasMedia
|
|||||||
{
|
{
|
||||||
$company = Company::find($this->company_id);
|
$company = Company::find($this->company_id);
|
||||||
|
|
||||||
$logo = $company->logo;
|
$logo = $company->logo_path;
|
||||||
|
|
||||||
view()->share([
|
view()->share([
|
||||||
'payment' => $this,
|
'payment' => $this,
|
||||||
|
|||||||
Reference in New Issue
Block a user