mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
All kinds of new stuff: finished most of the importing routines, extended the database (single table inheritance) and expanded some other stuff.
This commit is contained in:
14
app/models/Budget.php
Normal file
14
app/models/Budget.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: sander
|
||||
* Date: 05/07/14
|
||||
* Time: 18:24
|
||||
*/
|
||||
|
||||
class Budget extends Component {
|
||||
protected $isSubclass = true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
6
app/models/Category.php
Normal file
6
app/models/Category.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
class Category extends Component
|
||||
{
|
||||
protected $isSubclass = true;
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Component extends Elegant
|
||||
class Component extends Firefly\Database\SingleTableInheritanceEntity
|
||||
{
|
||||
|
||||
protected $table = 'components';
|
||||
protected $subclassField = 'class';
|
||||
|
||||
public static $rules
|
||||
= [
|
||||
'user_id' => 'exists:users,id|required',
|
||||
@@ -11,15 +15,14 @@ class Component extends Elegant
|
||||
];
|
||||
|
||||
|
||||
public function componentType()
|
||||
{
|
||||
return $this->belongsTo('ComponentType');
|
||||
}
|
||||
|
||||
public function transactions()
|
||||
{
|
||||
return $this->belongsToMany('Transaction');
|
||||
}
|
||||
public function transactionjournals()
|
||||
{
|
||||
return $this->belongsToMany('TransactionJournal');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ComponentType extends Eloquent
|
||||
{
|
||||
public function components()
|
||||
{
|
||||
return $this->hasMany('Component');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,4 +26,13 @@ class Transaction extends Elegant
|
||||
{
|
||||
return $this->belongsToMany('Component');
|
||||
}
|
||||
|
||||
public function budgets()
|
||||
{
|
||||
return $this->belongsToMany('Budget');
|
||||
}
|
||||
public function categories()
|
||||
{
|
||||
return $this->belongsToMany('Category');
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,21 @@ class TransactionJournal extends Elegant
|
||||
return $this->hasMany('Transaction');
|
||||
}
|
||||
|
||||
public function components()
|
||||
{
|
||||
return $this->belongsToMany('Component');
|
||||
}
|
||||
|
||||
public function budgets()
|
||||
{
|
||||
return $this->belongsToMany('Budget','component_transaction_journal','transaction_journal_id','component_id');
|
||||
}
|
||||
|
||||
public function categories()
|
||||
{
|
||||
return $this->belongsToMany('Category','component_transaction_journal','transaction_journal_id','component_id');
|
||||
}
|
||||
|
||||
public function getDates()
|
||||
{
|
||||
return array('created_at', 'updated_at', 'date');
|
||||
|
||||
Reference in New Issue
Block a user