Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Add some hasManyThrough references
James Coleec776bb6eb72
diff --git a/app/models/Account.php b/app/models/Account.phpindex 46e8fdc04d..e20e8f58ce 100644--- a/app/models/Account.php+++ b/app/models/Account.php@@ -145,6 +145,7 @@ class Account extends Ardent/*** TODO see if this scope is still used.+ ** @param Builder $query* @param array $types*/@@ -157,6 +158,11 @@ class Account extends Ardent$query->whereIn('account_types.type', $types);}+ public function transactionjournals()+ {+ return $this->hasManyThrough('TransactionJournal', 'Transaction');+ }+/*** User*diff --git a/app/models/Budget.php b/app/models/Budget.phpindex b5e516762c..7d5afae06a 100644--- a/app/models/Budget.php+++ b/app/models/Budget.php@@ -3,16 +3,16 @@/*** Budget*- * @property integer $id- * @property \Carbon\Carbon $created_at- * @property \Carbon\Carbon $updated_at- * @property string $name- * @property integer $user_id- * @property string $class- * @property-read \Illuminate\Database\Eloquent\Collection|\Limit[] $limits+ * @property integer $id+ * @property \Carbon\Carbon $created_at+ * @property \Carbon\Carbon $updated_at+ * @property string $name+ * @property integer $user_id+ * @property string $class+ * @property-read \Illuminate\Database\Eloquent\Collection|\Limit[] $limits* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals- * @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions- * @property-read \User $user+ * @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions+ * @property-read \User $user* @method static \Illuminate\Database\Query\Builder|\Budget whereId($value)* @method static \Illuminate\Database\Query\Builder|\Budget whereCreatedAt($value)* @method static \Illuminate\Database\Query\Builder|\Budget whereUpdatedAt($value)@@ -24,6 +24,11 @@ class Budget extends Component{protected $isSubclass = true;+ public function limitrepetitions()+ {+ return $this->hasManyThrough('LimitRepetition', 'Limit');+ }+/*** @return \Illuminate\Database\Eloquent\Relations\HasMany*/diff --git a/app/models/Component.php b/app/models/Component.phpindex 5f978e08d6..36493d8f65 100644--- a/app/models/Component.php+++ b/app/models/Component.php@@ -58,7 +58,6 @@ class Component extends SingleTableInheritanceEntityreturn $this->belongsToMany('TransactionJournal', 'component_transaction_journal', 'component_id');}-/*** @return \Illuminate\Database\Eloquent\Relations\BelongsToMany*/diff --git a/app/models/LimitRepetition.php b/app/models/LimitRepetition.phpindex e9e65bff86..651b5dd40e 100644--- a/app/models/LimitRepetition.php+++ b/app/models/LimitRepetition.php@@ -80,6 +80,7 @@ class LimitRepetition extends Ardentreturn $this->belongsTo('Limit');}+/*** TODO remove this method in favour of something in the FireflyIII libraries.*diff --git a/app/models/TransactionCurrency.php b/app/models/TransactionCurrency.phpindex 8a8512f87f..6c1aa0da36 100644--- a/app/models/TransactionCurrency.php+++ b/app/models/TransactionCurrency.php@@ -21,7 +21,7 @@ class TransactionCurrency extends Eloquent/*** @return \Illuminate\Database\Eloquent\Relations\HasMany*/- public function transactionjournals()+ public function transactionJournals(){return $this->hasMany('TransactionJournal');}diff --git a/app/models/User.php b/app/models/User.phpindex e58e572133..e92041ac74 100644--- a/app/models/User.php+++ b/app/models/User.php@@ -40,9 +40,13 @@ class User extends Ardent implements UserInterface, RemindableInterfacepublic static $rules- = ['email' => 'required|email|unique:users,email', 'migrated' => 'required|boolean', 'password' => 'required|between:60,60',- 'reset' => 'between:32,32',];- protected $fillable = ['email'];+ = [+ 'email' => 'required|email|unique:users,email',+ 'migrated' => 'required|boolean',+ 'password' => 'required|between:60,60',+ 'reset' => 'between:32,32',+ ];+ protected $fillable = ['email'];/*** The attributes excluded from the model's JSON form.*@@ -92,6 +96,10 @@ class User extends Ardent implements UserInterface, RemindableInterface{return $this->hasManyThrough('Piggybank', 'Account');}+ public function transactions()+ {+ return $this->hasManyThrough('TransactionJournal', 'Transaction');+ }/*** @return \Illuminate\Database\Eloquent\Relations\HasMany