mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 12:12:18 +00:00
Some code cleanup and fixes.
This commit is contained in:
@@ -10,8 +10,8 @@ class Category implements CategoryInterface
|
||||
public function journalsInRange(\Category $category, Carbon $start, Carbon $end)
|
||||
{
|
||||
return $category->transactionjournals()->with(
|
||||
['transactions', 'transactions.account', 'transactiontype', 'components']
|
||||
)->orderBy('date', 'DESC')->orderBy('id', 'DESC')->before($end)->after($start)->get();
|
||||
['transactions', 'transactions.account', 'transactiontype', 'components']
|
||||
)->orderBy('date', 'DESC')->orderBy('id', 'DESC')->before($end)->after($start)->get();
|
||||
|
||||
}
|
||||
}
|
@@ -96,7 +96,9 @@ class EloquentAccountRepository implements AccountRepositoryInterface
|
||||
public function findByName($name, \AccountType $type = null)
|
||||
{
|
||||
$type = is_null($type) ? \AccountType::where('description', 'Default account')->first() : $type;
|
||||
return \Auth::user()->accounts()->where('account_type_id',$type->id)->where('name', 'like', '%' . $name . '%')->first();
|
||||
|
||||
return \Auth::user()->accounts()->where('account_type_id', $type->id)->where('name', 'like', '%' . $name . '%')
|
||||
->first();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -7,8 +7,10 @@ use Carbon\Carbon;
|
||||
|
||||
class EloquentRecurringTransactionRepository implements RecurringTransactionRepositoryInterface
|
||||
{
|
||||
public function destroy(\RecurringTransaction $recurringTransaction) {
|
||||
public function destroy(\RecurringTransaction $recurringTransaction)
|
||||
{
|
||||
$recurringTransaction->delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -27,8 +29,9 @@ class EloquentRecurringTransactionRepository implements RecurringTransactionRepo
|
||||
$recurringTransaction->amount_min = floatval($data['amount_min']);
|
||||
|
||||
// both amounts zero:
|
||||
if($recurringTransaction->amount_max == 0 && $recurringTransaction->amount_min == 0) {
|
||||
$recurringTransaction->errors()->add('amount_max','Amount max and min cannot both be zero.');
|
||||
if ($recurringTransaction->amount_max == 0 && $recurringTransaction->amount_min == 0) {
|
||||
$recurringTransaction->errors()->add('amount_max', 'Amount max and min cannot both be zero.');
|
||||
|
||||
return $recurringTransaction;
|
||||
}
|
||||
|
||||
@@ -38,9 +41,10 @@ class EloquentRecurringTransactionRepository implements RecurringTransactionRepo
|
||||
$recurringTransaction->skip = isset($data['skip']) ? intval($data['skip']) : 0;
|
||||
$recurringTransaction->repeat_freq = $data['repeat_freq'];
|
||||
|
||||
if($recurringTransaction->validate()) {
|
||||
if ($recurringTransaction->validate()) {
|
||||
$recurringTransaction->save();
|
||||
}
|
||||
|
||||
return $recurringTransaction;
|
||||
}
|
||||
|
||||
|
@@ -392,7 +392,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
|
||||
|
||||
// do budget:
|
||||
$budget = $budRepository->find($data['budget_id']);
|
||||
if(!is_null($budget)) {
|
||||
if (!is_null($budget)) {
|
||||
$journal->budgets()->attach($budget);
|
||||
}
|
||||
|
||||
|
@@ -69,6 +69,7 @@ class EloquentUserRepository implements UserRepositoryInterface
|
||||
if (!$user->save()) {
|
||||
\Log::error('Invalid user');
|
||||
\Session::flash('error', 'Input invalid, please try again: ' . $user->errors()->first());
|
||||
|
||||
return false;
|
||||
}
|
||||
$user->save();
|
||||
|
Reference in New Issue
Block a user