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