Attachment system some file

This commit is contained in:
cuneytsenturk
2017-12-28 17:20:16 +03:00
parent 411de05efd
commit 97afc50cfa
16 changed files with 420 additions and 84 deletions

View File

@ -8,13 +8,21 @@ use App\Traits\DateTime;
use App\Traits\Incomes;
use Bkwld\Cloner\Cloneable;
use Sofa\Eloquence\Eloquence;
use Plank\Mediable\Mediable;
class Invoice extends Model
{
use Cloneable, Currencies, DateTime, Eloquence, Incomes;
use Cloneable, Currencies, DateTime, Eloquence, Incomes, Mediable;
protected $table = 'invoices';
/**
* The accessors to append to the model's array form.
*
* @var array
*/
protected $appends = ['attachment'];
protected $dates = ['deleted_at', 'invoiced_at', 'due_at'];
/**
@ -130,4 +138,18 @@ class Invoice extends Model
{
$this->attributes['currency_rate'] = (double) $value;
}
/**
* Get the current balance.
*
* @return string
*/
public function getAttachmentAttribute()
{
if (!$this->hasMedia('attachment')) {
return false;
}
return $this->getMedia('attachment')->first();
}
}