Company logo added media manager

This commit is contained in:
cuneytsenturk
2018-01-02 19:00:07 +03:00
parent 675b1ba42a
commit e3b736d3e8
4 changed files with 67 additions and 9 deletions

View File

@ -7,10 +7,11 @@ use EloquentFilter\Filterable;
use Illuminate\Database\Eloquent\Model as Eloquent;
use Illuminate\Database\Eloquent\SoftDeletes;
use Kyslik\ColumnSortable\Sortable;
use Plank\Mediable\Mediable;
class Company extends Eloquent
{
use Filterable, SoftDeletes, Sortable;
use Filterable, SoftDeletes, Sortable, Mediable;
protected $table = 'companies';
@ -229,4 +230,18 @@ class Company extends Eloquent
->orderBy('value', $direction)
->select('companies.*');
}
/**
* Get the current balance.
*
* @return string
*/
public function getLogoAttribute()
{
if (!$this->hasMedia('logo')) {
return false;
}
return $this->getMedia('logo')->last();
}
}