mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-18 04:19:12 +00:00
Code cleanup.
This commit is contained in:
@@ -7,11 +7,11 @@ use FireflyIII\Database\CommonDatabaseCallsInterface;
|
||||
use FireflyIII\Database\CUDInterface;
|
||||
use FireflyIII\Database\SwitchUser;
|
||||
use FireflyIII\Exception\NotImplementedException;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
|
||||
use Illuminate\Database\Query\Builder as QueryBuilder;
|
||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||
/**
|
||||
* Class Account
|
||||
*
|
||||
@@ -223,20 +223,21 @@ class Account implements CUDInterface, CommonDatabaseCallsInterface, AccountInte
|
||||
public function destroy(Eloquent $model)
|
||||
{
|
||||
|
||||
// delete piggy banks
|
||||
// delete journals:
|
||||
$journals = \TransactionJournal::whereIn(
|
||||
'id', function (Builder $query) use ($model) {
|
||||
'id', function (QueryBuilder $query) use ($model) {
|
||||
$query->select('transaction_journal_id')
|
||||
->from('transactions')->whereIn(
|
||||
'account_id', function (Builder $query) use ($model) {
|
||||
'account_id', function (QueryBuilder $query) use ($model) {
|
||||
$query
|
||||
->select('id')
|
||||
->from('accounts')
|
||||
->where(
|
||||
function (Builder $q) use ($model) {
|
||||
function (QueryBuilder $q) use ($model) {
|
||||
$q->where('id', $model->id);
|
||||
$q->orWhere(
|
||||
function (Builder $q) use ($model) {
|
||||
function (QueryBuilder $q) use ($model) {
|
||||
$q->where('accounts.name', 'LIKE', '%' . $model->name . '%');
|
||||
// TODO magic number!
|
||||
$q->where('accounts.account_type_id', 3);
|
||||
@@ -274,10 +275,10 @@ class Account implements CUDInterface, CommonDatabaseCallsInterface, AccountInte
|
||||
|
||||
// delete accounts:
|
||||
\Account::where(
|
||||
function (Builder $q) use ($model) {
|
||||
function (EloquentBuilder $q) use ($model) {
|
||||
$q->where('id', $model->id);
|
||||
$q->orWhere(
|
||||
function (Builder $q) use ($model) {
|
||||
function (EloquentBuilder $q) use ($model) {
|
||||
$q->where('accounts.name', 'LIKE', '%' . $model->name . '%');
|
||||
// TODO magic number!
|
||||
$q->where('accounts.account_type_id', 3);
|
||||
|
||||
@@ -10,7 +10,7 @@ use FireflyIII\Exception\NotImplementedException;
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
|
||||
/**
|
||||
* Class Budget
|
||||
@@ -336,7 +336,6 @@ class Budget implements CUDInterface, CommonDatabaseCallsInterface, BudgetInterf
|
||||
$limit->repeat_freq = 'monthly';
|
||||
$limit->repeats = 0;
|
||||
$result = $limit->save();
|
||||
\Log::info('Created new limit? ' . boolstr($result));
|
||||
\Log::info('ID: ' . $limit->id);
|
||||
/*
|
||||
* A newly stored limit also created a limit repetition.
|
||||
|
||||
@@ -35,7 +35,6 @@ class TransactionCurrency implements TransactionCurrencyInterface, CommonDatabas
|
||||
public function store(array $data)
|
||||
{
|
||||
$currency = new \TransactionCurrency($data);
|
||||
\Log::debug('Is valid? ' . boolstr($currency->isValid()));
|
||||
$currency->save();
|
||||
|
||||
return $currency;
|
||||
@@ -52,7 +51,6 @@ class TransactionCurrency implements TransactionCurrencyInterface, CommonDatabas
|
||||
$model->symbol = $data['symbol'];
|
||||
$model->code = $data['code'];
|
||||
$model->name = $data['name'];
|
||||
\Log::debug('Is valid? ' . boolstr($model->isValid()));
|
||||
$model->save();
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user