2013-11-26 14:45:07 +02:00
|
|
|
<?php
|
|
|
|
|
|
2013-12-04 18:20:14 +02:00
|
|
|
class Invoice extends EntityModel
|
2013-11-26 14:45:07 +02:00
|
|
|
{
|
2013-12-05 17:23:24 +02:00
|
|
|
protected $hidden = array('id', 'account_id', 'client_id', 'created_at', 'updated_at', 'deleted_at', 'viewed_date');
|
2013-12-03 19:32:33 +02:00
|
|
|
|
2013-12-01 22:58:25 +02:00
|
|
|
public function account()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo('Account');
|
|
|
|
|
}
|
2013-11-26 14:45:07 +02:00
|
|
|
|
|
|
|
|
public function client()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo('Client');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function invoice_items()
|
|
|
|
|
{
|
|
|
|
|
return $this->hasMany('InvoiceItem');
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-01 09:33:17 +02:00
|
|
|
public function invoice_status()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo('InvoiceStatus');
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-01 22:58:25 +02:00
|
|
|
public function getName()
|
|
|
|
|
{
|
|
|
|
|
return $this->invoice_number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getEntityType()
|
|
|
|
|
{
|
|
|
|
|
return ENTITY_INVOICE;
|
|
|
|
|
}
|
2013-11-26 23:45:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Invoice::created(function($invoice)
|
|
|
|
|
{
|
|
|
|
|
Activity::createInvoice($invoice);
|
|
|
|
|
});
|