2014-06-29 15:12:33 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
2014-07-03 14:31:32 -05:00
|
|
|
class Transaction extends Elegant
|
2014-06-29 15:12:33 -05:00
|
|
|
{
|
2014-07-03 14:31:32 -05:00
|
|
|
public static $rules
|
|
|
|
= [
|
|
|
|
'account_id' => 'numeric|required|exists:accounts,id',
|
|
|
|
'transaction_journal_id' => 'numeric|required|exists:transaction_journals,id',
|
|
|
|
'description' => 'between:1,255',
|
|
|
|
'amount' => 'required|between:-65536,65536',
|
|
|
|
];
|
|
|
|
|
2014-06-29 15:12:33 -05:00
|
|
|
|
|
|
|
public function account()
|
|
|
|
{
|
|
|
|
return $this->belongsTo('Account');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function transactionJournal()
|
|
|
|
{
|
|
|
|
return $this->belongsTo('TransactionJournal');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function components()
|
|
|
|
{
|
|
|
|
return $this->belongsToMany('Component');
|
|
|
|
}
|
|
|
|
}
|