mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix various code style issues.
This commit is contained in:
parent
e247aace8d
commit
1b4d55cca4
@ -172,14 +172,14 @@ class ConvertController extends Controller
|
||||
switch ($joined) {
|
||||
default:
|
||||
throw new FireflyException('Cannot handle ' . $joined);
|
||||
case TransactionType::WITHDRAWAL . '-' . TransactionType::DEPOSIT: # one
|
||||
case TransactionType::WITHDRAWAL . '-' . TransactionType::DEPOSIT: // one
|
||||
$destination = $sourceAccount;
|
||||
break;
|
||||
case TransactionType::WITHDRAWAL . '-' . TransactionType::TRANSFER: # two
|
||||
case TransactionType::WITHDRAWAL . '-' . TransactionType::TRANSFER: // two
|
||||
$destination = $accountRepository->find(intval($data['destination_account_asset']));
|
||||
break;
|
||||
case TransactionType::DEPOSIT . '-' . TransactionType::WITHDRAWAL: # three
|
||||
case TransactionType::TRANSFER . '-' . TransactionType::WITHDRAWAL: #five
|
||||
case TransactionType::DEPOSIT . '-' . TransactionType::WITHDRAWAL: // three
|
||||
case TransactionType::TRANSFER . '-' . TransactionType::WITHDRAWAL: // five
|
||||
$data = [
|
||||
'name' => $data['destination_account_expense'],
|
||||
'accountType' => 'expense',
|
||||
@ -189,8 +189,8 @@ class ConvertController extends Controller
|
||||
];
|
||||
$destination = $accountRepository->store($data);
|
||||
break;
|
||||
case TransactionType::DEPOSIT . '-' . TransactionType::TRANSFER: # four
|
||||
case TransactionType::TRANSFER . '-' . TransactionType::DEPOSIT: #six
|
||||
case TransactionType::DEPOSIT . '-' . TransactionType::TRANSFER: // four
|
||||
case TransactionType::TRANSFER . '-' . TransactionType::DEPOSIT: // six
|
||||
$destination = $destinationAccount;
|
||||
break;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ class Account extends Model
|
||||
public static function firstOrCreateEncrypted(array $fields)
|
||||
{
|
||||
// everything but the name:
|
||||
$query = Account::orderBy('id');
|
||||
$query = self::orderBy('id');
|
||||
$search = $fields;
|
||||
unset($search['name'], $search['iban']);
|
||||
|
||||
@ -81,7 +81,7 @@ class Account extends Model
|
||||
}
|
||||
|
||||
// create it!
|
||||
$account = Account::create($fields);
|
||||
$account = self::create($fields);
|
||||
|
||||
return $account;
|
||||
|
||||
|
@ -43,7 +43,7 @@ class Budget extends Model
|
||||
public static function firstOrCreateEncrypted(array $fields)
|
||||
{
|
||||
// everything but the name:
|
||||
$query = Budget::orderBy('id');
|
||||
$query = self::orderBy('id');
|
||||
$search = $fields;
|
||||
unset($search['name']);
|
||||
foreach ($search as $name => $value) {
|
||||
@ -57,7 +57,7 @@ class Budget extends Model
|
||||
}
|
||||
}
|
||||
// create it!
|
||||
$budget = Budget::create($fields);
|
||||
$budget = self::create($fields);
|
||||
|
||||
return $budget;
|
||||
|
||||
|
@ -42,7 +42,7 @@ class Category extends Model
|
||||
public static function firstOrCreateEncrypted(array $fields)
|
||||
{
|
||||
// everything but the name:
|
||||
$query = Category::orderBy('id');
|
||||
$query = self::orderBy('id');
|
||||
$search = $fields;
|
||||
unset($search['name']);
|
||||
foreach ($search as $name => $value) {
|
||||
@ -56,7 +56,7 @@ class Category extends Model
|
||||
}
|
||||
}
|
||||
// create it!
|
||||
$category = Category::create($fields);
|
||||
$category = self::create($fields);
|
||||
|
||||
return $category;
|
||||
|
||||
|
@ -37,7 +37,7 @@ class LimitRepetition extends Model
|
||||
public static function routeBinder($value)
|
||||
{
|
||||
if (auth()->check()) {
|
||||
$object = LimitRepetition::where('limit_repetitions.id', $value)
|
||||
$object = self::where('limit_repetitions.id', $value)
|
||||
->leftJoin('budget_limits', 'budget_limits.id', '=', 'limit_repetitions.budget_limit_id')
|
||||
->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
|
||||
->where('budgets.user_id', auth()->user()->id)
|
||||
|
@ -43,7 +43,7 @@ class Tag extends TagSupport
|
||||
$search = $fields;
|
||||
unset($search['tag']);
|
||||
|
||||
$query = Tag::orderBy('id');
|
||||
$query = self::orderBy('id');
|
||||
foreach ($search as $name => $value) {
|
||||
$query->where($name, $value);
|
||||
}
|
||||
@ -57,7 +57,7 @@ class Tag extends TagSupport
|
||||
// create it!
|
||||
$fields['tagMode'] = 'nothing';
|
||||
$fields['description'] = $fields['description'] ?? '';
|
||||
$tag = Tag::create($fields);
|
||||
$tag = self::create($fields);
|
||||
|
||||
return $tag;
|
||||
|
||||
|
@ -64,7 +64,7 @@ class TransactionJournal extends TransactionJournalSupport
|
||||
public static function routeBinder($value)
|
||||
{
|
||||
if (auth()->check()) {
|
||||
$object = TransactionJournal::where('transaction_journals.id', $value)
|
||||
$object = self::where('transaction_journals.id', $value)
|
||||
->with('transactionType')
|
||||
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
|
||||
->where('user_id', auth()->user()->id)->first(['transaction_journals.*']);
|
||||
|
@ -57,7 +57,7 @@ class TransactionType extends Model
|
||||
*/
|
||||
public function isDeposit()
|
||||
{
|
||||
return $this->type === TransactionType::DEPOSIT;
|
||||
return $this->type === self::DEPOSIT;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,7 +65,7 @@ class TransactionType extends Model
|
||||
*/
|
||||
public function isOpeningBalance()
|
||||
{
|
||||
return $this->type === TransactionType::OPENING_BALANCE;
|
||||
return $this->type === self::OPENING_BALANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,7 +73,7 @@ class TransactionType extends Model
|
||||
*/
|
||||
public function isTransfer()
|
||||
{
|
||||
return $this->type === TransactionType::TRANSFER;
|
||||
return $this->type === self::TRANSFER;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,7 +81,7 @@ class TransactionType extends Model
|
||||
*/
|
||||
public function isWithdrawal()
|
||||
{
|
||||
return $this->type === TransactionType::WITHDRAWAL;
|
||||
return $this->type === self::WITHDRAWAL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -199,8 +199,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
*/
|
||||
public function getAllBudgetLimitRepetitions(Carbon $start, Carbon $end): Collection
|
||||
{
|
||||
$query = LimitRepetition::
|
||||
leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
|
||||
$query = LimitRepetition::leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
|
||||
->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
|
||||
->where('limit_repetitions.startdate', '<=', $end->format('Y-m-d 00:00:00'))
|
||||
->where('limit_repetitions.startdate', '>=', $start->format('Y-m-d 00:00:00'))
|
||||
|
@ -136,8 +136,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
public function reset(): bool
|
||||
{
|
||||
// split query to make it work in sqlite:
|
||||
$set = PiggyBank::
|
||||
leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.id')
|
||||
$set = PiggyBank::leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.id')
|
||||
->where('accounts.user_id', $this->user->id)->get(['piggy_banks.*']);
|
||||
foreach ($set as $e) {
|
||||
$e->order = 0;
|
||||
|
@ -159,8 +159,7 @@ class Steam
|
||||
return $cache->get();
|
||||
}
|
||||
|
||||
$balances = Transaction::
|
||||
leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
$balances = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->where('transaction_journals.date', '<=', $date->format('Y-m-d'))
|
||||
->groupBy('transactions.account_id')
|
||||
->whereIn('transactions.account_id', $ids)
|
||||
|
@ -296,8 +296,7 @@ class FireflyValidator extends Validator
|
||||
{
|
||||
$accountId = $this->data['id'] ?? 0;
|
||||
|
||||
$query = AccountMeta::
|
||||
leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id')
|
||||
$query = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id')
|
||||
->where('accounts.user_id', auth()->user()->id)
|
||||
->where('account_meta.name', 'accountNumber');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user