invoiceninja/app/models/Payment.php

55 lines
793 B
PHP
Raw Normal View History

2013-11-26 14:45:07 +02:00
<?php
2013-12-04 18:20:14 +02:00
class Payment extends EntityModel
2013-11-26 14:45:07 +02:00
{
public function invoice()
{
2014-02-19 15:28:29 +02:00
return $this->belongsTo('Invoice')->withTrashed();;
2013-11-26 14:45:07 +02:00
}
2013-12-01 22:58:25 +02:00
2013-12-07 20:45:00 +02:00
public function invitation()
{
return $this->belongsTo('Invitation');
}
2013-12-05 17:23:24 +02:00
public function client()
{
2014-02-19 15:28:29 +02:00
return $this->belongsTo('Client')->withTrashed();;
2013-12-05 17:23:24 +02:00
}
2014-01-29 12:41:38 +02:00
public function account()
{
return $this->belongsTo('Account');
}
public function contact()
{
return $this->belongsTo('Contact');
}
2013-12-01 22:58:25 +02:00
public function getName()
{
return '';
}
public function getEntityType()
{
return ENTITY_PAYMENT;
}
2013-11-26 23:45:10 +02:00
}
Payment::created(function($payment)
{
Activity::createPayment($payment);
2014-01-14 11:52:56 +00:00
});
Payment::updating(function($payment)
{
Activity::updatePayment($payment);
});
Payment::deleting(function($payment)
{
Activity::archivePayment($payment);
2013-11-26 23:45:10 +02:00
});