Attachment system some file
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user