mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Better ability to store piggy banks.
This commit is contained in:
@@ -55,7 +55,7 @@ class PiggyBank extends Model
|
||||
'target_amount' => 'string',
|
||||
];
|
||||
|
||||
protected $fillable = ['name', 'account_id', 'order', 'target_amount', 'start_date', 'start_date_tz', 'target_date', 'target_date_tz', 'active'];
|
||||
protected $fillable = ['name', 'account_id', 'order', 'target_amount', 'start_date', 'start_date_tz', 'target_date', 'target_date_tz', 'active','transaction_currency_id'];
|
||||
|
||||
/**
|
||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||
@@ -67,9 +67,9 @@ class PiggyBank extends Model
|
||||
if (auth()->check()) {
|
||||
$piggyBankId = (int)$value;
|
||||
$piggyBank = self::where('piggy_banks.id', $piggyBankId)
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
|
||||
->where('accounts.user_id', auth()->user()->id)->first(['piggy_banks.*'])
|
||||
;
|
||||
->leftJoin('account_piggy_bank','account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id')
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id')
|
||||
->where('accounts.user_id', auth()->user()->id)->first(['piggy_banks.*']);
|
||||
if (null !== $piggyBank) {
|
||||
return $piggyBank;
|
||||
}
|
||||
|
Reference in New Issue
Block a user