close #231 : Bill attachment not working

This commit is contained in:
cuneytsenturk
2018-03-06 17:22:59 +03:00
parent f394a61773
commit 0f87195254
8 changed files with 143 additions and 41 deletions

View File

@ -5,10 +5,11 @@ namespace App\Models\Expense;
use App\Models\Model;
use Bkwld\Cloner\Cloneable;
use Sofa\Eloquence\Eloquence;
use App\Traits\Media;
class Vendor extends Model
{
use Cloneable, Eloquence;
use Cloneable, Eloquence, Media;
protected $table = 'vendors';
@ -53,4 +54,20 @@ class Vendor extends Model
{
return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code');
}
/**
* Get the current balance.
*
* @return string
*/
public function getLogoAttribute($value)
{
if (!empty($value) && !$this->hasMedia('logo')) {
return $value;
} elseif (!$this->hasMedia('logo')) {
return false;
}
return $this->getMedia('logo')->last();
}
}