First attempt at an import/migration procedure.

This commit is contained in:
James Cole
2014-07-03 21:31:32 +02:00
parent 35c90a32e9
commit 1836249407
13 changed files with 259 additions and 89 deletions

View File

@@ -1,8 +1,16 @@
<?php
class Transaction extends Eloquent
class Transaction extends Elegant
{
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',
];
public function account()
{

View File

@@ -1,17 +1,35 @@
<?php
class TransactionJournal extends Eloquent {
class TransactionJournal extends Elegant
{
public function transactionType() {
public static $rules
= [
'transaction_type_id' => 'required|exists:transaction_types,id',
'transaction_currency_id' => 'required|exists:transaction_currencies,id',
'description' => 'between:1,255',
'date' => 'date',
];
public function transactionType()
{
return $this->belongsTo('TransactionType');
}
public function transactionCurrency() {
public function transactionCurrency()
{
return $this->belongsTo('TransactionCurrency');
}
public function transactions() {
public function transactions()
{
return $this->hasMany('Transaction');
}
public function getDates()
{
return array('created_at', 'updated_at', 'date');
}
}