Skip to content

Firefly III: a personal finances manager

Various code cleanup.

James Colefd2edf3b23f6
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 0000000000..4d95c00b5f
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1,2 @@
+# code owners for this Firefly III related repository
+* @JC5 @SDx3
\ No newline at end of file
diff --git a/app/Api/V2/Controllers/Transaction/List/TransactionController.php b/app/Api/V2/Controllers/Transaction/List/TransactionController.php
index 6dbb617016..b8459d7ec9 100644
--- a/app/Api/V2/Controllers/Transaction/List/TransactionController.php
+++ b/app/Api/V2/Controllers/Transaction/List/TransactionController.php
@@ -35,24 +35,24 @@ use Illuminate\Http\JsonResponse;
*/
class TransactionController extends Controller
{
- public function list(ListRequest $request): JsonResponse
+ public function infiniteList(InfiniteListRequest $request): JsonResponse
{
- // collect transactions:
- $pageSize = $this->parameters->get('limit');
- $page = $request->getPage();
- $page = max($page, 1);
+ // get sort instructions
+ $instructions = $request->getSortInstructions('transactions');
+ // collect transactions:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setUserGroup(auth()->user()->userGroup)
->withAPIInformation()
- ->setLimit($pageSize)
- ->setPage($page)
+ ->setStartRow($request->getStartRow())
+ ->setEndRow($request->getEndRow())
->setTypes($request->getTransactionTypes())
+ ->setSorting($instructions)
;
- $start = $this->parameters->get('start');
- $end = $this->parameters->get('end');
+ $start = $this->parameters->get('start');
+ $end = $this->parameters->get('end');
if (null !== $start) {
$collector->setStart($start);
}
@@ -60,12 +60,12 @@ class TransactionController extends Controller
$collector->setEnd($end);
}
- $paginator = $collector->getPaginatedGroups();
- $params = $request->buildParams($pageSize);
+ $paginator = $collector->getPaginatedGroups();
+ $params = $request->buildParams();
$paginator->setPath(
sprintf(
'%s?%s',
- route('api.v2.transactions.list'),
+ route('api.v2.infinite.transactions.list'),
$params
)
);
@@ -76,24 +76,24 @@ class TransactionController extends Controller
;
}
- public function infiniteList(InfiniteListRequest $request): JsonResponse
+ public function list(ListRequest $request): JsonResponse
{
- // get sort instructions
- $instructions = $request->getSortInstructions('transactions');
-
// collect transactions:
+ $pageSize = $this->parameters->get('limit');
+ $page = $request->getPage();
+ $page = max($page, 1);
+
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setUserGroup(auth()->user()->userGroup)
->withAPIInformation()
- ->setStartRow($request->getStartRow())
- ->setEndRow($request->getEndRow())
+ ->setLimit($pageSize)
+ ->setPage($page)
->setTypes($request->getTransactionTypes())
- ->setSorting($instructions)
;
- $start = $this->parameters->get('start');
- $end = $this->parameters->get('end');
+ $start = $this->parameters->get('start');
+ $end = $this->parameters->get('end');
if (null !== $start) {
$collector->setStart($start);
}
@@ -101,19 +101,18 @@ class TransactionController extends Controller
$collector->setEnd($end);
}
- $paginator = $collector->getPaginatedGroups();
- $params = $request->buildParams();
+ $paginator = $collector->getPaginatedGroups();
+ $params = $request->buildParams($pageSize);
$paginator->setPath(
sprintf(
'%s?%s',
- route('api.v2.infinite.transactions.list'),
+ route('api.v2.transactions.list'),
$params
)
);
return response()
->json($this->jsonApiList('transactions', $paginator, new TransactionGroupTransformer()))
- ->header('Content-Type', self::CONTENT_TYPE)
- ;
+ ->header('Content-Type', self::CONTENT_TYPE);
}
}
diff --git a/app/Api/V2/Request/Model/Transaction/InfiniteListRequest.php b/app/Api/V2/Request/Model/Transaction/InfiniteListRequest.php
index e8eff1f433..05e613185f 100644
--- a/app/Api/V2/Request/Model/Transaction/InfiniteListRequest.php
+++ b/app/Api/V2/Request/Model/Transaction/InfiniteListRequest.php
@@ -83,6 +83,13 @@ class InfiniteListRequest extends FormRequest
return $this->getCarbonDate('end');
}
+ public function getAccountTypes(): array
+ {
+ $type = (string)$this->get('type', 'default');
+
+ return $this->mapAccountTypes($type);
+ }
+
public function getPage(): int
{
$page = $this->convertInteger('page');
@@ -122,13 +129,6 @@ class InfiniteListRequest extends FormRequest
return $this->mapTransactionTypes($type);
}
- public function getAccountTypes(): array
- {
- $type = (string)$this->get('type', 'default');
-
- return $this->mapAccountTypes($type);
- }
-
public function rules(): array
{
return [
diff --git a/app/Console/Commands/Correction/DeleteEmptyGroups.php b/app/Console/Commands/Correction/DeleteEmptyGroups.php
index aa769e9dde..3ba5ea8515 100644
--- a/app/Console/Commands/Correction/DeleteEmptyGroups.php
+++ b/app/Console/Commands/Correction/DeleteEmptyGroups.php
@@ -47,7 +47,7 @@ class DeleteEmptyGroups extends Command
{
$groupIds
= TransactionGroup::leftJoin('transaction_journals', 'transaction_groups.id', '=', 'transaction_journals.transaction_group_id')
- ->whereNull('transaction_journals.id')->get(['transaction_groups.id'])->pluck('id')->toArray()
+ ->whereNull('transaction_journals.id')->get(['transaction_groups.id'])->pluck('id')->toArray()
;
$total = count($groupIds);
diff --git a/app/Console/Commands/System/ForceDecimalSize.php b/app/Console/Commands/System/ForceDecimalSize.php
index 19cda1faa2..383f004554 100644
--- a/app/Console/Commands/System/ForceDecimalSize.php
+++ b/app/Console/Commands/System/ForceDecimalSize.php
@@ -74,19 +74,19 @@ class ForceDecimalSize extends Command
private string $regularExpression;
private array $tables
= [
- 'accounts' => ['virtual_balance'],
- 'auto_budgets' => ['amount'],
- 'available_budgets' => ['amount'],
- 'bills' => ['amount_min', 'amount_max'],
- 'budget_limits' => ['amount'],
- 'currency_exchange_rates' => ['rate', 'user_rate'],
- 'limit_repetitions' => ['amount'],
- 'piggy_bank_events' => ['amount'],
- 'piggy_bank_repetitions' => ['currentamount'],
- 'piggy_banks' => ['targetamount'],
- 'recurrences_transactions' => ['amount', 'foreign_amount'],
- 'transactions' => ['amount', 'foreign_amount'],
- ];
+ 'accounts' => ['virtual_balance'],
+ 'auto_budgets' => ['amount'],
+ 'available_budgets' => ['amount'],
+ 'bills' => ['amount_min', 'amount_max'],
+ 'budget_limits' => ['amount'],
+ 'currency_exchange_rates' => ['rate', 'user_rate'],
+ 'limit_repetitions' => ['amount'],
+ 'piggy_bank_events' => ['amount'],
+ 'piggy_bank_repetitions' => ['currentamount'],
+ 'piggy_banks' => ['targetamount'],
+ 'recurrences_transactions' => ['amount', 'foreign_amount'],
+ 'transactions' => ['amount', 'foreign_amount'],
+ ];
/**
* Execute the console command.
diff --git a/app/Generator/Webhook/StandardMessageGenerator.php b/app/Generator/Webhook/StandardMessageGenerator.php
index 0a8302710a..929988f5e7 100644
--- a/app/Generator/Webhook/StandardMessageGenerator.php
+++ b/app/Generator/Webhook/StandardMessageGenerator.php
@@ -72,31 +72,6 @@ class StandardMessageGenerator implements MessageGeneratorInterface
$this->run();
}
- public function getVersion(): int
- {
- return $this->version;
- }
-
- public function setObjects(Collection $objects): void
- {
- $this->objects = $objects;
- }
-
- public function setTrigger(int $trigger): void
- {
- $this->trigger = $trigger;
- }
-
- public function setUser(User $user): void
- {
- $this->user = $user;
- }
-
- public function setWebhooks(Collection $webhooks): void
- {
- $this->webhooks = $webhooks;
- }
-
private function getWebhooks(): Collection
{
return $this->user->webhooks()->where('active', true)->where('trigger', $this->trigger)->get(['webhooks.*']);
@@ -206,6 +181,11 @@ class StandardMessageGenerator implements MessageGeneratorInterface
$this->storeMessage($webhook, $basicMessage);
}
+ public function getVersion(): int
+ {
+ return $this->version;
+ }
+
private function collectAccounts(TransactionGroup $transactionGroup): Collection
{
$accounts = new Collection();
@@ -232,4 +212,24 @@ class StandardMessageGenerator implements MessageGeneratorInterface
$webhookMessage->save();
app('log')->debug(sprintf('Stored new webhook message #%d', $webhookMessage->id));
}
+
+ public function setObjects(Collection $objects): void
+ {
+ $this->objects = $objects;
+ }
+
+ public function setTrigger(int $trigger): void
+ {
+ $this->trigger = $trigger;
+ }
+
+ public function setUser(User $user): void
+ {
+ $this->user = $user;
+ }
+
+ public function setWebhooks(Collection $webhooks): void
+ {
+ $this->webhooks = $webhooks;
+ }
}
diff --git a/app/Helpers/Collector/Extensions/CollectorProperties.php b/app/Helpers/Collector/Extensions/CollectorProperties.php
index fa6c626fbc..f23b33c7ba 100644
--- a/app/Helpers/Collector/Extensions/CollectorProperties.php
+++ b/app/Helpers/Collector/Extensions/CollectorProperties.php
@@ -33,10 +33,11 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
*/
trait CollectorProperties
{
+ public const string TEST = 'Test';
+
/** @var array<int, string> */
public array $sorting;
- public const string TEST = 'Test';
- private ?int $endRow;
+ private ?int $endRow;
private bool $expandGroupSearch;
private array $fields;
private bool $hasAccountInfo;
@@ -52,7 +53,7 @@ trait CollectorProperties
private ?int $page;
private array $postFilters;
private HasMany $query;
- private ?int $startRow;
+ private ?int $startRow;
private array $stringFields;
/*
* This array is used to collect ALL tags the user may search for (using 'setTags').
diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php
index ee0bbdf333..d528a3e4f8 100644
--- a/app/Helpers/Collector/GroupCollector.php
+++ b/app/Helpers/Collector/GroupCollector.php
@@ -25,6 +25,7 @@ namespace FireflyIII\Helpers\Collector;
use Carbon\Carbon;
use Carbon\Exceptions\InvalidFormatException;
+use Exception;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\Extensions\AccountCollection;
use FireflyIII\Helpers\Collector\Extensions\AmountCollection;
@@ -782,6 +783,35 @@ class GroupCollector implements GroupCollectorInterface
return $currentCollection;
}
+ #[\Override]
+ public function sortCollection(Collection $collection): Collection
+ {
+ /**
+ * @var string $field
+ * @var string $direction
+ */
+ foreach ($this->sorting as $field => $direction) {
+ $func = 'ASC' === $direction ? 'sortBy' : 'sortByDesc';
+ $collection = $collection->{$func}(function (array $product, int $key) use ($field) { // @phpstan-ignore-line
+ // depends on $field:
+ if ('description' === $field) {
+ if (1 === count($product['transactions'])) {
+ return array_values($product['transactions'])[0][$field];
+ }
+ if (count($product['transactions']) > 1) {
+ return $product['title'];
+ }
+
+ return 'zzz';
+ }
+
+ exit('here we are');
+ });
+ }
+
+ return $collection;
+ }
+
/**
* Same as getGroups but everything is in a paginator.
*/
@@ -932,6 +962,14 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
+ #[\Override]
+ public function setSorting(array $instructions): GroupCollectorInterface
+ {
+ $this->sorting = $instructions;
+
+ return $this;
+ }
+
public function setStartRow(int $startRow): self
{
$this->startRow = $startRow;
@@ -1087,45 +1125,7 @@ class GroupCollector implements GroupCollectorInterface
// include budget ID + name (if any)
->withBudgetInformation()
// include bill ID + name (if any)
- ->withBillInformation()
- ;
-
- return $this;
- }
-
- #[\Override]
- public function sortCollection(Collection $collection): Collection
- {
- /**
- * @var string $field
- * @var string $direction
- */
- foreach ($this->sorting as $field => $direction) {
- $func = 'ASC' === $direction ? 'sortBy' : 'sortByDesc';
- $collection = $collection->{$func}(function (array $product, int $key) use ($field) { // @phpstan-ignore-line
- // depends on $field:
- if ('description' === $field) {
- if (1 === count($product['transactions'])) {
- return array_values($product['transactions'])[0][$field];
- }
- if (count($product['transactions']) > 1) {
- return $product['title'];
- }
-
- return 'zzz';
- }
-
- exit('here we are');
- });
- }
-
- return $collection;
- }
-
- #[\Override]
- public function setSorting(array $instructions): GroupCollectorInterface
- {
- $this->sorting = $instructions;
+ ->withBillInformation();
return $this;
}
diff --git a/app/Helpers/Collector/GroupCollectorInterface.php b/app/Helpers/Collector/GroupCollectorInterface.php
index a77fb36adb..936176cb00 100644
--- a/app/Helpers/Collector/GroupCollectorInterface.php
+++ b/app/Helpers/Collector/GroupCollectorInterface.php
@@ -285,13 +285,6 @@ interface GroupCollectorInterface
*/
public function getPaginatedGroups(): LengthAwarePaginator;
- public function setSorting(array $instructions): self;
-
- /**
- * Sort the collection on a column.
- */
- public function sortCollection(Collection $collection): Collection;
-
public function hasAnyTag(): self;
/**
@@ -560,6 +553,8 @@ interface GroupCollectorInterface
public function setSepaCT(string $sepaCT): self;
+ public function setSorting(array $instructions): self;
+
/**
* Set source accounts.
*/
@@ -620,6 +615,11 @@ interface GroupCollectorInterface
*/
public function setXorAccounts(Collection $accounts): self;
+ /**
+ * Sort the collection on a column.
+ */
+ public function sortCollection(Collection $collection): Collection;
+
/**
* Automatically include all stuff required to make API calls work.
*/
diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.php
index 1e39f98e65..3104b526f7 100644
--- a/app/Helpers/Report/NetWorth.php
+++ b/app/Helpers/Report/NetWorth.php
@@ -51,7 +51,7 @@ class NetWorth implements NetWorthInterface
private CurrencyRepositoryInterface $currencyRepos;
private User $user;
- private ?UserGroup $userGroup;
+ private ?UserGroup $userGroup;
/**
* This method collects the user's net worth in ALL the user's currencies
diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.php
index 787cd0c2c2..f4714dc8dc 100644
--- a/app/Http/Controllers/Budget/IndexController.php
+++ b/app/Http/Controllers/Budget/IndexController.php
@@ -277,11 +277,11 @@ class IndexController extends Controller
// also calculate how much left from budgeted:
$sums['left'][$currencyId]
??= [
- 'amount' => '0',
- 'currency_id' => $budgeted['currency_id'],
- 'currency_symbol' => $budgeted['currency_symbol'],
- 'currency_decimal_places' => $budgeted['currency_decimal_places'],
- ];
+ 'amount' => '0',
+ 'currency_id' => $budgeted['currency_id'],
+ 'currency_symbol' => $budgeted['currency_symbol'],
+ 'currency_decimal_places' => $budgeted['currency_decimal_places'],
+ ];
}
}
diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php
index 42be033f2b..aaf1504ecd 100644
--- a/app/Http/Controllers/Chart/CategoryController.php
+++ b/app/Http/Controllers/Chart/CategoryController.php
@@ -192,11 +192,11 @@ class CategoryController extends Controller
$chartData[$inKey]
= [
- 'label' => sprintf('%s (%s)', (string)trans('firefly.earned'), $currencyInfo['currency_name']),
- 'entries' => [],
- 'type' => 'bar',
- 'backgroundColor' => 'rgba(0, 141, 76, 0.5)', // green
- ];
+ 'label' => sprintf('%s (%s)', (string)trans('firefly.earned'), $currencyInfo['currency_name']),
+ 'entries' => [],
+ 'type' => 'bar',
+ 'backgroundColor' => 'rgba(0, 141, 76, 0.5)', // green
+ ];
// loop empty periods:
foreach (array_keys($periods) as $period) {
$label = $periods[$period];
diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php
index 44116553ce..01c8cec108 100644
--- a/app/Http/Controllers/DebugController.php
+++ b/app/Http/Controllers/DebugController.php
@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers;
use Carbon\Carbon;
+use Exception;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Middleware\IsDemoUser;
use FireflyIII\Models\AccountType;
diff --git a/app/Http/Controllers/JavascriptController.php b/app/Http/Controllers/JavascriptController.php
index f7068f2751..f07a6d3874 100644
--- a/app/Http/Controllers/JavascriptController.php
+++ b/app/Http/Controllers/JavascriptController.php
@@ -144,7 +144,6 @@ class JavascriptController extends Controller
return response()
->view('v2.javascript.variables', $data)
- ->header('Content-Type', 'text/javascript')
- ;
+ ->header('Content-Type', 'text/javascript');
}
}
diff --git a/app/Http/Controllers/Json/ReconcileController.php b/app/Http/Controllers/Json/ReconcileController.php
index 70a0bb9136..bc1193dd30 100644
--- a/app/Http/Controllers/Json/ReconcileController.php
+++ b/app/Http/Controllers/Json/ReconcileController.php
@@ -139,6 +139,37 @@ class ReconcileController extends Controller
return response()->json($return);
}
+ private function processJournal(Account $account, TransactionCurrency $currency, array $journal, string $amount): string
+ {
+ $toAdd = '0';
+ app('log')->debug(sprintf('User submitted %s #%d: "%s"', $journal['transaction_type_type'], $journal['transaction_journal_id'], $journal['description']));
+
+ // not much magic below we need to cover using tests.
+
+ if ($account->id === $journal['source_account_id']) {
+ if ($currency->id === $journal['currency_id']) {
+ $toAdd = $journal['amount'];
+ }
+ if (null !== $journal['foreign_currency_id'] && $journal['foreign_currency_id'] === $currency->id) {
+ $toAdd = $journal['foreign_amount'];
+ }
+ }
+ if ($account->id === $journal['destination_account_id']) {
+ if ($currency->id === $journal['currency_id']) {
+ $toAdd = bcmul($journal['amount'], '-1');
+ }
+ if (null !== $journal['foreign_currency_id'] && $journal['foreign_currency_id'] === $currency->id) {
+ $toAdd = bcmul($journal['foreign_amount'], '-1');
+ }
+ }
+
+ app('log')->debug(sprintf('Going to add %s to %s', $toAdd, $amount));
+ $amount = bcadd($amount, $toAdd);
+ app('log')->debug(sprintf('Result is %s', $amount));
+
+ return $amount;
+ }
+
/**
* Returns a list of transactions in a modal.
*
@@ -195,37 +226,6 @@ class ReconcileController extends Controller
return response()->json(['html' => $html, 'startBalance' => $startBalance, 'endBalance' => $endBalance]);
}
- private function processJournal(Account $account, TransactionCurrency $currency, array $journal, string $amount): string
- {
- $toAdd = '0';
- app('log')->debug(sprintf('User submitted %s #%d: "%s"', $journal['transaction_type_type'], $journal['transaction_journal_id'], $journal['description']));
-
- // not much magic below we need to cover using tests.
-
- if ($account->id === $journal['source_account_id']) {
- if ($currency->id === $journal['currency_id']) {
- $toAdd = $journal['amount'];
- }
- if (null !== $journal['foreign_currency_id'] && $journal['foreign_currency_id'] === $currency->id) {
- $toAdd = $journal['foreign_amount'];
- }
- }
- if ($account->id === $journal['destination_account_id']) {
- if ($currency->id === $journal['currency_id']) {
- $toAdd = bcmul($journal['amount'], '-1');
- }
- if (null !== $journal['foreign_currency_id'] && $journal['foreign_currency_id'] === $currency->id) {
- $toAdd = bcmul($journal['foreign_amount'], '-1');
- }
- }
-
- app('log')->debug(sprintf('Going to add %s to %s', $toAdd, $amount));
- $amount = bcadd($amount, $toAdd);
- app('log')->debug(sprintf('Result is %s', $amount));
-
- return $amount;
- }
-
/**
* "fix" amounts to make it easier on the reconciliation overview:
*/
diff --git a/app/Models/Account.php b/app/Models/Account.php
index 9736462044..c6ed9908e7 100644
--- a/app/Models/Account.php
+++ b/app/Models/Account.php
@@ -122,13 +122,13 @@ class Account extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'user_id' => 'integer',
- 'deleted_at' => 'datetime',
- 'active' => 'boolean',
- 'encrypted' => 'boolean',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'user_id' => 'integer',
+ 'deleted_at' => 'datetime',
+ 'active' => 'boolean',
+ 'encrypted' => 'boolean',
+ ];
protected $fillable = ['user_id', 'user_group_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
diff --git a/app/Models/AccountMeta.php b/app/Models/AccountMeta.php
index 799543776c..a3c37ed271 100644
--- a/app/Models/AccountMeta.php
+++ b/app/Models/AccountMeta.php
@@ -59,9 +59,9 @@ class AccountMeta extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ ];
protected $fillable = ['account_id', 'name', 'data'];
diff --git a/app/Models/AccountType.php b/app/Models/AccountType.php
index 54036c23ab..c2a942460a 100644
--- a/app/Models/AccountType.php
+++ b/app/Models/AccountType.php
@@ -72,9 +72,9 @@ class AccountType extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ ];
protected $fillable = ['type'];
diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php
index c0dedb7db3..e2ef680150 100644
--- a/app/Models/Attachment.php
+++ b/app/Models/Attachment.php
@@ -97,11 +97,11 @@ class Attachment extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'uploaded' => 'boolean',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'uploaded' => 'boolean',
+ ];
protected $fillable = ['attachable_id', 'attachable_type', 'user_id', 'md5', 'filename', 'mime', 'title', 'description', 'size', 'uploaded'];
diff --git a/app/Models/AvailableBudget.php b/app/Models/AvailableBudget.php
index 95bdaa6120..8a3d8c7e91 100644
--- a/app/Models/AvailableBudget.php
+++ b/app/Models/AvailableBudget.php
@@ -80,13 +80,13 @@ class AvailableBudget extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'start_date' => 'date',
- 'end_date' => 'date',
- 'transaction_currency_id' => 'int',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'start_date' => 'date',
+ 'end_date' => 'date',
+ 'transaction_currency_id' => 'int',
+ ];
protected $fillable = ['user_id', 'user_group_id', 'transaction_currency_id', 'amount', 'start_date', 'end_date'];
diff --git a/app/Models/Bill.php b/app/Models/Bill.php
index ff50cc7aa6..5b7e65ce61 100644
--- a/app/Models/Bill.php
+++ b/app/Models/Bill.php
@@ -114,36 +114,36 @@ class Bill extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'date' => 'date',
- 'end_date' => 'date',
- 'extension_date' => 'date',
- 'skip' => 'int',
- 'automatch' => 'boolean',
- 'active' => 'boolean',
- 'name_encrypted' => 'boolean',
- 'match_encrypted' => 'boolean',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'date' => 'date',
+ 'end_date' => 'date',
+ 'extension_date' => 'date',
+ 'skip' => 'int',
+ 'automatch' => 'boolean',
+ 'active' => 'boolean',
+ 'name_encrypted' => 'boolean',
+ 'match_encrypted' => 'boolean',
+ ];
protected $fillable
= [
- 'name',
- 'match',
- 'amount_min',
- 'user_id',
- 'user_group_id',
- 'amount_max',
- 'date',
- 'repeat_freq',
- 'skip',
- 'automatch',
- 'active',
- 'transaction_currency_id',
- 'end_date',
- 'extension_date',
- ];
+ 'name',
+ 'match',
+ 'amount_min',
+ 'user_id',
+ 'user_group_id',
+ 'amount_max',
+ 'date',
+ 'repeat_freq',
+ 'skip',
+ 'automatch',
+ 'active',
+ 'transaction_currency_id',
+ 'end_date',
+ 'extension_date',
+ ];
protected $hidden = ['amount_min_encrypted', 'amount_max_encrypted', 'name_encrypted', 'match_encrypted'];
diff --git a/app/Models/Budget.php b/app/Models/Budget.php
index dd7f9a5a6b..3c13dba221 100644
--- a/app/Models/Budget.php
+++ b/app/Models/Budget.php
@@ -97,12 +97,12 @@ class Budget extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'active' => 'boolean',
- 'encrypted' => 'boolean',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'active' => 'boolean',
+ 'encrypted' => 'boolean',
+ ];
protected $fillable = ['user_id', 'name', 'active', 'order', 'user_group_id'];
diff --git a/app/Models/BudgetLimit.php b/app/Models/BudgetLimit.php
index e8528e5e40..58bc881614 100644
--- a/app/Models/BudgetLimit.php
+++ b/app/Models/BudgetLimit.php
@@ -74,18 +74,18 @@ class BudgetLimit extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'start_date' => 'date',
- 'end_date' => 'date',
- 'auto_budget' => 'boolean',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'start_date' => 'date',
+ 'end_date' => 'date',
+ 'auto_budget' => 'boolean',
+ ];
protected $dispatchesEvents
= [
- 'created' => Created::class,
- 'updated' => Updated::class,
- 'deleted' => Deleted::class,
- ];
+ 'created' => Created::class,
+ 'updated' => Updated::class,
+ 'deleted' => Deleted::class,
+ ];
protected $fillable = ['budget_id', 'start_date', 'end_date', 'amount', 'transaction_currency_id'];
diff --git a/app/Models/Category.php b/app/Models/Category.php
index 5901af1e7c..007d95d0f5 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -86,11 +86,11 @@ class Category extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'encrypted' => 'boolean',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'encrypted' => 'boolean',
+ ];
protected $fillable = ['user_id', 'user_group_id', 'name'];
diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php
index 815e3aaa63..9d07d927f0 100644
--- a/app/Models/Configuration.php
+++ b/app/Models/Configuration.php
@@ -62,10 +62,10 @@ class Configuration extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ ];
/** @var string The table to store the data in */
protected $table = 'configuration';
diff --git a/app/Models/LinkType.php b/app/Models/LinkType.php
index f08edd46c8..eb3f5f9f15 100644
--- a/app/Models/LinkType.php
+++ b/app/Models/LinkType.php
@@ -72,11 +72,11 @@ class LinkType extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'editable' => 'boolean',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'editable' => 'boolean',
+ ];
protected $fillable = ['name', 'inward', 'outward', 'editable'];
diff --git a/app/Models/Location.php b/app/Models/Location.php
index 4b0d913db2..10962cb375 100644
--- a/app/Models/Location.php
+++ b/app/Models/Location.php
@@ -74,13 +74,13 @@ class Location extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'zoomLevel' => 'int',
- 'latitude' => 'float',
- 'longitude' => 'float',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'zoomLevel' => 'int',
+ 'latitude' => 'float',
+ 'longitude' => 'float',
+ ];
protected $fillable = ['locatable_id', 'locatable_type', 'latitude', 'longitude', 'zoom_level'];
diff --git a/app/Models/Note.php b/app/Models/Note.php
index d3238150da..d1fb218940 100644
--- a/app/Models/Note.php
+++ b/app/Models/Note.php
@@ -69,10 +69,10 @@ class Note extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ ];
protected $fillable = ['title', 'text', 'noteable_id', 'noteable_type'];
diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php
index 912748415f..0ae5b7432d 100644
--- a/app/Models/PiggyBank.php
+++ b/app/Models/PiggyBank.php
@@ -92,15 +92,15 @@ class PiggyBank extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'startdate' => 'date',
- 'targetdate' => 'date',
- 'order' => 'int',
- 'active' => 'boolean',
- 'encrypted' => 'boolean',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'startdate' => 'date',
+ 'targetdate' => 'date',
+ 'order' => 'int',
+ 'active' => 'boolean',
+ 'encrypted' => 'boolean',
+ ];
protected $fillable = ['name', 'account_id', 'order', 'targetamount', 'startdate', 'targetdate', 'active'];
diff --git a/app/Models/PiggyBankEvent.php b/app/Models/PiggyBankEvent.php
index 75eef73b50..0fc4268c03 100644
--- a/app/Models/PiggyBankEvent.php
+++ b/app/Models/PiggyBankEvent.php
@@ -63,10 +63,10 @@ class PiggyBankEvent extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'date' => 'date',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'date' => 'date',
+ ];
protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'amount'];
diff --git a/app/Models/PiggyBankRepetition.php b/app/Models/PiggyBankRepetition.php
index 5926e1a7bc..5ef34f96ad 100644
--- a/app/Models/PiggyBankRepetition.php
+++ b/app/Models/PiggyBankRepetition.php
@@ -64,11 +64,11 @@ class PiggyBankRepetition extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'startdate' => 'date',
- 'targetdate' => 'date',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'startdate' => 'date',
+ 'targetdate' => 'date',
+ ];
protected $fillable = ['piggy_bank_id', 'startdate', 'targetdate', 'currentamount'];
diff --git a/app/Models/Preference.php b/app/Models/Preference.php
index 005c9769f8..82758bf0b8 100644
--- a/app/Models/Preference.php
+++ b/app/Models/Preference.php
@@ -63,10 +63,10 @@ class Preference extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'data' => 'array',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'data' => 'array',
+ ];
protected $fillable = ['user_id', 'data', 'name'];
diff --git a/app/Models/Recurrence.php b/app/Models/Recurrence.php
index 7b9756c31b..e6a1d8fed1 100644
--- a/app/Models/Recurrence.php
+++ b/app/Models/Recurrence.php
@@ -104,19 +104,19 @@ class Recurrence extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'title' => 'string',
- 'id' => 'int',
- 'description' => 'string',
- 'first_date' => 'date',
- 'repeat_until' => 'date',
- 'latest_date' => 'date',
- 'repetitions' => 'int',
- 'active' => 'bool',
- 'apply_rules' => 'bool',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'title' => 'string',
+ 'id' => 'int',
+ 'description' => 'string',
+ 'first_date' => 'date',
+ 'repeat_until' => 'date',
+ 'latest_date' => 'date',
+ 'repetitions' => 'int',
+ 'active' => 'bool',
+ 'apply_rules' => 'bool',
+ ];
protected $fillable
= ['user_id', 'transaction_type_id', 'title', 'description', 'first_date', 'repeat_until', 'latest_date', 'repetitions', 'apply_rules', 'active'];
diff --git a/app/Models/RecurrenceMeta.php b/app/Models/RecurrenceMeta.php
index d7bd0c060d..d3d34abf10 100644
--- a/app/Models/RecurrenceMeta.php
+++ b/app/Models/RecurrenceMeta.php
@@ -67,12 +67,12 @@ class RecurrenceMeta extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'name' => 'string',
- 'value' => 'string',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'name' => 'string',
+ 'value' => 'string',
+ ];
protected $fillable = ['recurrence_id', 'name', 'value'];
diff --git a/app/Models/RecurrenceRepetition.php b/app/Models/RecurrenceRepetition.php
index efcb09c1b4..c63a456434 100644
--- a/app/Models/RecurrenceRepetition.php
+++ b/app/Models/RecurrenceRepetition.php
@@ -76,14 +76,14 @@ class RecurrenceRepetition extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'repetition_type' => 'string',
- 'repetition_moment' => 'string',
- 'repetition_skip' => 'int',
- 'weekend' => 'int',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'repetition_type' => 'string',
+ 'repetition_moment' => 'string',
+ 'repetition_skip' => 'int',
+ 'weekend' => 'int',
+ ];
protected $fillable = ['recurrence_id', 'weekend', 'repetition_type', 'repetition_moment', 'repetition_skip'];
diff --git a/app/Models/RecurrenceTransaction.php b/app/Models/RecurrenceTransaction.php
index f3bf0a5791..0d4364e8c7 100644
--- a/app/Models/RecurrenceTransaction.php
+++ b/app/Models/RecurrenceTransaction.php
@@ -91,25 +91,25 @@ class RecurrenceTransaction extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'amount' => 'string',
- 'foreign_amount' => 'string',
- 'description' => 'string',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'amount' => 'string',
+ 'foreign_amount' => 'string',
+ 'description' => 'string',
+ ];
protected $fillable
= [
- 'recurrence_id',
- 'transaction_currency_id',
- 'foreign_currency_id',
- 'source_id',
- 'destination_id',
- 'amount',
- 'foreign_amount',
- 'description',
- ];
+ 'recurrence_id',
+ 'transaction_currency_id',
+ 'foreign_currency_id',
+ 'source_id',
+ 'destination_id',
+ 'amount',
+ 'foreign_amount',
+ 'description',
+ ];
/** @var string The table to store the data in */
protected $table = 'recurrences_transactions';
diff --git a/app/Models/RecurrenceTransactionMeta.php b/app/Models/RecurrenceTransactionMeta.php
index e0a60d4163..6bb4eea372 100644
--- a/app/Models/RecurrenceTransactionMeta.php
+++ b/app/Models/RecurrenceTransactionMeta.php
@@ -67,12 +67,12 @@ class RecurrenceTransactionMeta extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'name' => 'string',
- 'value' => 'string',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'name' => 'string',
+ 'value' => 'string',
+ ];
protected $fillable = ['rt_id', 'name', 'value'];
diff --git a/app/Models/Role.php b/app/Models/Role.php
index b356c6fc15..39a6216f1f 100644
--- a/app/Models/Role.php
+++ b/app/Models/Role.php
@@ -62,9 +62,9 @@ class Role extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ ];
protected $fillable = ['name', 'display_name', 'description'];
diff --git a/app/Models/Rule.php b/app/Models/Rule.php
index 8ccc7c44bc..befb9640b1 100644
--- a/app/Models/Rule.php
+++ b/app/Models/Rule.php
@@ -95,15 +95,15 @@ class Rule extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'active' => 'boolean',
- 'order' => 'int',
- 'stop_processing' => 'boolean',
- 'id' => 'int',
- 'strict' => 'boolean',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'active' => 'boolean',
+ 'order' => 'int',
+ 'stop_processing' => 'boolean',
+ 'id' => 'int',
+ 'strict' => 'boolean',
+ ];
protected $fillable = ['rule_group_id', 'order', 'active', 'title', 'description', 'user_id', 'strict'];
diff --git a/app/Models/RuleAction.php b/app/Models/RuleAction.php
index f8f8e5fe12..a8756a5d50 100644
--- a/app/Models/RuleAction.php
+++ b/app/Models/RuleAction.php
@@ -66,12 +66,12 @@ class RuleAction extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'active' => 'boolean',
- 'order' => 'int',
- 'stop_processing' => 'boolean',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'active' => 'boolean',
+ 'order' => 'int',
+ 'stop_processing' => 'boolean',
+ ];
protected $fillable = ['rule_id', 'action_type', 'action_value', 'order', 'active', 'stop_processing'];
diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.php
index 67e6c42f23..a363e72919 100644
--- a/app/Models/RuleGroup.php
+++ b/app/Models/RuleGroup.php
@@ -85,13 +85,13 @@ class RuleGroup extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'active' => 'boolean',
- 'stop_processing' => 'boolean',
- 'order' => 'int',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'active' => 'boolean',
+ 'stop_processing' => 'boolean',
+ 'order' => 'int',
+ ];
protected $fillable = ['user_id', 'user_group_id', 'stop_processing', 'order', 'title', 'description', 'active'];
diff --git a/app/Models/RuleTrigger.php b/app/Models/RuleTrigger.php
index e617ee8b21..6d14358ebd 100644
--- a/app/Models/RuleTrigger.php
+++ b/app/Models/RuleTrigger.php
@@ -66,12 +66,12 @@ class RuleTrigger extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'active' => 'boolean',
- 'order' => 'int',
- 'stop_processing' => 'boolean',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'active' => 'boolean',
+ 'order' => 'int',
+ 'stop_processing' => 'boolean',
+ ];
protected $fillable = ['rule_id', 'trigger_type', 'trigger_value', 'order', 'active', 'stop_processing'];
diff --git a/app/Models/Tag.php b/app/Models/Tag.php
index 9ba92bc9f3..c5fa90814f 100644
--- a/app/Models/Tag.php
+++ b/app/Models/Tag.php
@@ -93,14 +93,14 @@ class Tag extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'date' => 'date',
- 'zoomLevel' => 'int',
- 'latitude' => 'float',
- 'longitude' => 'float',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'date' => 'date',
+ 'zoomLevel' => 'int',
+ 'latitude' => 'float',
+ 'longitude' => 'float',
+ ];
protected $fillable = ['user_id', 'user_group_id', 'tag', 'date', 'description', 'tagMode'];
diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php
index 974cc3d7a7..4626848073 100644
--- a/app/Models/Transaction.php
+++ b/app/Models/Transaction.php
@@ -99,28 +99,28 @@ class Transaction extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'identifier' => 'int',
- 'encrypted' => 'boolean', // model does not have these fields though
- 'bill_name_encrypted' => 'boolean',
- 'reconciled' => 'boolean',
- 'date' => 'datetime',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'identifier' => 'int',
+ 'encrypted' => 'boolean', // model does not have these fields though
+ 'bill_name_encrypted' => 'boolean',
+ 'reconciled' => 'boolean',
+ 'date' => 'datetime',
+ ];
protected $fillable
= [
- 'account_id',
- 'transaction_journal_id',
- 'description',
- 'amount',
- 'identifier',
- 'transaction_currency_id',
- 'foreign_currency_id',
- 'foreign_amount',
- 'reconciled',
- ];
+ 'account_id',
+ 'transaction_journal_id',
+ 'description',
+ 'amount',
+ 'identifier',
+ 'transaction_currency_id',
+ 'foreign_currency_id',
+ 'foreign_amount',
+ 'reconciled',
+ ];
protected $hidden = ['encrypted'];
diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php
index 886bc8a4c8..8d0c58d319 100644
--- a/app/Models/TransactionCurrency.php
+++ b/app/Models/TransactionCurrency.php
@@ -89,12 +89,12 @@ class TransactionCurrency extends Model
public ?bool $userGroupEnabled;
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'decimal_places' => 'int',
- 'enabled' => 'bool',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'decimal_places' => 'int',
+ 'enabled' => 'bool',
+ ];
protected $fillable = ['name', 'code', 'symbol', 'decimal_places', 'enabled'];
diff --git a/app/Models/TransactionGroup.php b/app/Models/TransactionGroup.php
index 76e4d64a82..6922513c49 100644
--- a/app/Models/TransactionGroup.php
+++ b/app/Models/TransactionGroup.php
@@ -78,13 +78,13 @@ class TransactionGroup extends Model
protected $casts
= [
- 'id' => 'integer',
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'title' => 'string',
- 'date' => 'datetime',
- ];
+ 'id' => 'integer',
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'title' => 'string',
+ 'date' => 'datetime',
+ ];
protected $fillable = ['user_id', 'user_group_id', 'title'];
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index b5e77ee825..fd26fbcc05 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -138,32 +138,32 @@ class TransactionJournal extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- 'date' => 'datetime',
- 'interest_date' => 'date',
- 'book_date' => 'date',
- 'process_date' => 'date',
- 'order' => 'int',
- 'tag_count' => 'int',
- 'encrypted' => 'boolean',
- 'completed' => 'boolean',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ 'date' => 'datetime',
+ 'interest_date' => 'date',
+ 'book_date' => 'date',
+ 'process_date' => 'date',
+ 'order' => 'int',
+ 'tag_count' => 'int',
+ 'encrypted' => 'boolean',
+ 'completed' => 'boolean',
+ ];
protected $fillable
= [
- 'user_id',
- 'user_group_id',
- 'transaction_type_id',
- 'bill_id',
- 'tag_count',
- 'transaction_currency_id',
- 'description',
- 'completed',
- 'order',
- 'date',
- ];
+ 'user_id',
+ 'user_group_id',
+ 'transaction_type_id',
+ 'bill_id',
+ 'tag_count',
+ 'transaction_currency_id',
+ 'description',
+ 'completed',
+ 'order',
+ 'date',
+ ];
protected $hidden = ['encrypted'];
diff --git a/app/Models/TransactionJournalLink.php b/app/Models/TransactionJournalLink.php
index f3237f4664..01923e8318 100644
--- a/app/Models/TransactionJournalLink.php
+++ b/app/Models/TransactionJournalLink.php
@@ -71,9 +71,9 @@ class TransactionJournalLink extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ ];
/** @var string The table to store the data in */
protected $table = 'journal_links';
diff --git a/app/Models/TransactionJournalMeta.php b/app/Models/TransactionJournalMeta.php
index 2b94815cfa..767eccd314 100644
--- a/app/Models/TransactionJournalMeta.php
+++ b/app/Models/TransactionJournalMeta.php
@@ -69,10 +69,10 @@ class TransactionJournalMeta extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ ];
protected $fillable = ['transaction_journal_id', 'name', 'data', 'hash'];
diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php
index 7e9c4551bc..e888294824 100644
--- a/app/Models/TransactionType.php
+++ b/app/Models/TransactionType.php
@@ -73,10 +73,10 @@ class TransactionType extends Model
protected $casts
= [
- 'created_at' => 'datetime',
- 'updated_at' => 'datetime',
- 'deleted_at' => 'datetime',
- ];
+ 'created_at' => 'datetime',
+ 'updated_at' => 'datetime',
+ 'deleted_at' => 'datetime',
+ ];
protected $fillable = ['type'];
/**
diff --git a/app/Repositories/Budget/AvailableBudgetRepository.php b/app/Repositories/Budget/AvailableBudgetRepository.php
index 7aac372c31..c4114c2641 100644
--- a/app/Repositories/Budget/AvailableBudgetRepository.php
+++ b/app/Repositories/Budget/AvailableBudgetRepository.php
@@ -202,7 +202,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
$availableBudget->user()->associate($this->user);
$availableBudget->transactionCurrency()->associate($currency);
$availableBudget->start_date = $start->startOfDay()->format('Y-m-d'); // @phpstan-ignore-line
- $availableBudget->end_date = $end->endOfDay()->format('Y-m-d'); // @phpstan-ignore-line
+ $availableBudget->end_date = $end->endOfDay()->format('Y-m-d'); // @phpstan-ignore-line
}
$availableBudget->amount = $amount;
$availableBudget->save();
diff --git a/app/Repositories/Category/NoCategoryRepository.php b/app/Repositories/Category/NoCategoryRepository.php
index 1da423c8b0..d74749f2df 100644
--- a/app/Repositories/Category/NoCategoryRepository.php
+++ b/app/Repositories/Category/NoCategoryRepository.php
@@ -75,9 +75,9 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
$journalId = (int)$journal['transaction_journal_id'];
$array[$currencyId]['categories'][0]['transaction_journals'][$journalId]
= [
- 'amount' => app('steam')->negative($journal['amount']),
- 'date' => $journal['date'],
- ];
+ 'amount' => app('steam')->negative($journal['amount']),
+ 'date' => $journal['date'],
+ ];
}
return $array;
@@ -128,9 +128,9 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
$journalId = (int)$journal['transaction_journal_id'];
$array[$currencyId]['categories'][0]['transaction_journals'][$journalId]
= [
- 'amount' => app('steam')->positive($journal['amount']),
- 'date' => $journal['date'],
- ];
+ 'amount' => app('steam')->positive($journal['amount']),
+ 'date' => $journal['date'],
+ ];
}
return $array;
diff --git a/app/Repositories/UserGroups/Account/AccountRepository.php b/app/Repositories/UserGroups/Account/AccountRepository.php
index 2ada2b6f5f..d3f43220f0 100644
--- a/app/Repositories/UserGroups/Account/AccountRepository.php
+++ b/app/Repositories/UserGroups/Account/AccountRepository.php
@@ -39,6 +39,17 @@ class AccountRepository implements AccountRepositoryInterface
{
use UserGroupTrait;
+ #[\Override]
+ public function countAccounts(array $types): int
+ {
+ $query = $this->userGroup->accounts();
+ if (0 !== count($types)) {
+ $query->accountTypeIn($types);
+ }
+
+ return $query->count();
+ }
+
public function findByAccountNumber(string $number, array $types): ?Account
{
$dbQuery = $this->userGroup
@@ -161,25 +172,25 @@ class AccountRepository implements AccountRepositoryInterface
return $query->get(['accounts.*']);
}
- public function getAccountsByType(array $types, ?array $sort = []): Collection
+ #[\Override]
+ public function getAccountsInOrder(array $types, array $sort, int $startRow, int $endRow): Collection
{
- $res = array_intersect([AccountType::ASSET, AccountType::MORTGAGE, AccountType::LOAN, AccountType::DEBT], $types);
$query = $this->userGroup->accounts();
if (0 !== count($types)) {
$query->accountTypeIn($types);
}
+ $query->skip($startRow);
+ $query->take($endRow - $startRow);
// add sort parameters. At this point they're filtered to allowed fields to sort by:
if (0 !== count($sort)) {
- foreach ($sort as $param) {
- $query->orderBy($param[0], $param[1]);
+ foreach ($sort as $label => $direction) {
+ $query->orderBy(sprintf('accounts.%s', $label), $direction);
}
}
if (0 === count($sort)) {
- if (0 !== count($res)) {
- $query->orderBy('accounts.order', 'ASC');
- }
+ $query->orderBy('accounts.order', 'ASC');
$query->orderBy('accounts.active', 'DESC');
$query->orderBy('accounts.name', 'ASC');
}
@@ -201,32 +212,6 @@ class AccountRepository implements AccountRepositoryInterface
return $query->get(['accounts.*']);
}
- public function searchAccount(string $query, array $types, int $limit): Collection
- {
- // search by group, not by user
- $dbQuery = $this->userGroup->accounts()
- ->where('active', true)
- ->orderBy('accounts.order', 'ASC')
- ->orderBy('accounts.account_type_id', 'ASC')
- ->orderBy('accounts.name', 'ASC')
- ->with(['accountType'])
- ;
- if ('' !== $query) {
- // split query on spaces just in case:
- $parts = explode(' ', $query);
- foreach ($parts as $part) {
- $search = sprintf('%%%s%%', $part);
- $dbQuery->where('name', 'LIKE', $search);
- }
- }
- if (0 !== count($types)) {
- $dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
- $dbQuery->whereIn('account_types.type', $types);
- }
-
- return $dbQuery->take($limit)->get(['accounts.*']);
- }
-
public function resetAccountOrder(): void
{
$sets = [
@@ -252,25 +237,25 @@ class AccountRepository implements AccountRepositoryInterface
}
}
- #[\Override]
- public function getAccountsInOrder(array $types, array $sort, int $startRow, int $endRow): Collection
+ public function getAccountsByType(array $types, ?array $sort = []): Collection
{
+ $res = array_intersect([AccountType::ASSET, AccountType::MORTGAGE, AccountType::LOAN, AccountType::DEBT], $types);
$query = $this->userGroup->accounts();
if (0 !== count($types)) {
$query->accountTypeIn($types);
}
- $query->skip($startRow);
- $query->take($endRow - $startRow);
// add sort parameters. At this point they're filtered to allowed fields to sort by:
if (0 !== count($sort)) {
- foreach ($sort as $label => $direction) {
- $query->orderBy(sprintf('accounts.%s', $label), $direction);
+ foreach ($sort as $param) {
+ $query->orderBy($param[0], $param[1]);
}
}
if (0 === count($sort)) {
- $query->orderBy('accounts.order', 'ASC');
+ if (0 !== count($res)) {
+ $query->orderBy('accounts.order', 'ASC');
+ }
$query->orderBy('accounts.active', 'DESC');
$query->orderBy('accounts.name', 'ASC');
}
@@ -278,14 +263,29 @@ class AccountRepository implements AccountRepositoryInterface
return $query->get(['accounts.*']);
}
- #[\Override]
- public function countAccounts(array $types): int
+ public function searchAccount(string $query, array $types, int $limit): Collection
{
- $query = $this->userGroup->accounts();
+ // search by group, not by user
+ $dbQuery = $this->userGroup->accounts()
+ ->where('active', true)
+ ->orderBy('accounts.order', 'ASC')
+ ->orderBy('accounts.account_type_id', 'ASC')
+ ->orderBy('accounts.name', 'ASC')
+ ->with(['accountType'])
+ ;
+ if ('' !== $query) {
+ // split query on spaces just in case:
+ $parts = explode(' ', $query);
+ foreach ($parts as $part) {
+ $search = sprintf('%%%s%%', $part);
+ $dbQuery->where('name', 'LIKE', $search);
+ }
+ }
if (0 !== count($types)) {
- $query->accountTypeIn($types);
+ $dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
+ $dbQuery->whereIn('account_types.type', $types);
}
- return $query->count();
+ return $dbQuery->take($limit)->get(['accounts.*']);
}
}
diff --git a/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php b/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php
index a9b934442a..9a70b42795 100644
--- a/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php
+++ b/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php
@@ -35,6 +35,8 @@ use Illuminate\Support\Collection;
*/
interface AccountRepositoryInterface
{
+ public function countAccounts(array $types): int;
+
public function find(int $accountId): ?Account;
public function findByAccountNumber(string $number, array $types): ?Account;
@@ -49,8 +51,6 @@ interface AccountRepositoryInterface
public function getAccountsByType(array $types, ?array $sort = []): Collection;
- public function countAccounts(array $types): int;
-
/**
* Used in the infinite accounts list.
*/
@@ -63,14 +63,14 @@ interface AccountRepositoryInterface
*/
public function getMetaValue(Account $account, string $field): ?string;
+ /**
+ * Reset order types of the mentioned accounts.
+ */
+ public function resetAccountOrder(): void;
+
public function searchAccount(string $query, array $types, int $limit): Collection;
public function setUser(User $user): void;
public function setUserGroup(UserGroup $userGroup): void;
-
- /**
- * Reset order types of the mentioned accounts.
- */
- public function resetAccountOrder(): void;
}
diff --git a/app/Rules/UniqueIban.php b/app/Rules/UniqueIban.php
index 3bc00be090..6df894dfd4 100644
--- a/app/Rules/UniqueIban.php
+++ b/app/Rules/UniqueIban.php
@@ -146,10 +146,10 @@ class UniqueIban implements ValidationRule
}
$query
= auth()->user()
- ->accounts()
- ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
- ->where('accounts.iban', $iban)
- ->whereIn('account_types.type', $typesArray)
+ ->accounts()
+ ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
+ ->where('accounts.iban', $iban)
+ ->whereIn('account_types.type', $typesArray)
;
if (null !== $this->account) {
diff --git a/app/Support/Authentication/RemoteUserGuard.php b/app/Support/Authentication/RemoteUserGuard.php
index fa3ed47409..a5182734fb 100644
--- a/app/Support/Authentication/RemoteUserGuard.php
+++ b/app/Support/Authentication/RemoteUserGuard.php
@@ -39,7 +39,7 @@ class RemoteUserGuard implements Guard
{
protected Application $application;
protected UserProvider $provider;
- protected ?User $user;
+ protected ?User $user;
/**
* Create a new authentication guard.
diff --git a/app/Support/Http/Controllers/PeriodOverview.php b/app/Support/Http/Controllers/PeriodOverview.php
index c35213211a..15d8d43ac8 100644
--- a/app/Support/Http/Controllers/PeriodOverview.php
+++ b/app/Support/Http/Controllers/PeriodOverview.php
@@ -566,13 +566,13 @@ trait PeriodOverview
}
$entries[]
= [
- 'title' => $title,
- 'route' => route('transactions.index', [$transactionType, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]),
- 'total_transactions' => count($spent) + count($earned) + count($transferred),
- 'spent' => $this->groupByCurrency($spent),
- 'earned' => $this->groupByCurrency($earned),
- 'transferred' => $this->groupByCurrency($transferred),
- ];
+ 'title' => $title,
+ 'route' => route('transactions.index', [$transactionType, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]),
+ 'total_transactions' => count($spent) + count($earned) + count($transferred),
+ 'spent' => $this->groupByCurrency($spent),
+ 'earned' => $this->groupByCurrency($earned),
+ 'transferred' => $this->groupByCurrency($transferred),
+ ];
}
return $entries;
diff --git a/app/Support/Report/Budget/BudgetReportGenerator.php b/app/Support/Report/Budget/BudgetReportGenerator.php
index 7059886943..f2836bcca4 100644
--- a/app/Support/Report/Budget/BudgetReportGenerator.php
+++ b/app/Support/Report/Budget/BudgetReportGenerator.php
@@ -213,16 +213,16 @@ class BudgetReportGenerator
// make sum information:
$this->report['sums'][$currencyId]
??= [
- 'budgeted' => '0',
- 'spent' => '0',
- 'left' => '0',
- 'overspent' => '0',
- 'currency_id' => $currencyId,
- 'currency_code' => $limitCurrency->code,
- 'currency_name' => $limitCurrency->name,
- 'currency_symbol' => $limitCurrency->symbol,
- 'currency_decimal_places' => $limitCurrency->decimal_places,
- ];
+ 'budgeted' => '0',
+ 'spent' => '0',
+ 'left' => '0',
+ 'overspent' => '0',
+ 'currency_id' => $currencyId,
+ 'currency_code' => $limitCurrency->code,
+ 'currency_name' => $limitCurrency->name,
+ 'currency_symbol' => $limitCurrency->symbol,
+ 'currency_decimal_places' => $limitCurrency->decimal_places,
+ ];
$this->report['sums'][$currencyId]['budgeted'] = bcadd($this->report['sums'][$currencyId]['budgeted'], $limit->amount);
$this->report['sums'][$currencyId]['spent'] = bcadd($this->report['sums'][$currencyId]['spent'], $spent);
$this->report['sums'][$currencyId]['left'] = bcadd($this->report['sums'][$currencyId]['left'], bcadd($limit->amount, $spent));
diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php
index da850a4019..d71498a67f 100644
--- a/app/Support/Search/OperatorQuerySearch.php
+++ b/app/Support/Search/OperatorQuerySearch.php
@@ -72,9 +72,9 @@ class OperatorQuerySearch implements SearchInterface
private GroupCollectorInterface $collector;
private CurrencyRepositoryInterface $currencyRepository;
private array $excludeTags;
- private array $includeTags;
- // added to fix #8632
private array $includeAnyTags;
+ // added to fix #8632
+ private array $includeTags;
private array $invalidOperators;
private int $limit;
private Collection $operators;
diff --git a/app/Transformers/V2/TransactionGroupTransformer.php b/app/Transformers/V2/TransactionGroupTransformer.php
index 7838b24fca..5f0b60cb0c 100644
--- a/app/Transformers/V2/TransactionGroupTransformer.php
+++ b/app/Transformers/V2/TransactionGroupTransformer.php
@@ -47,7 +47,7 @@ use Illuminate\Support\Facades\DB;
class TransactionGroupTransformer extends AbstractTransformer
{
private array $accountTypes = []; // account types collection.
- private ExchangeRateConverter $converter; // collection of all journals and some important meta-data.
+ private ExchangeRateConverter $converter; // collection of all journals and some important meta-data.
private array $currencies = [];
private TransactionCurrency $default; // collection of all currencies for this transformer.
private array $journals = [];
diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php
index 891fcc6163..477f748163 100644
--- a/app/Validation/FireflyValidator.php
+++ b/app/Validation/FireflyValidator.php
@@ -824,8 +824,7 @@ class FireflyValidator extends Validator
->where('trigger', $trigger)
->where('response', $response)
->where('delivery', $delivery)
- ->where('url', $url)->count()
- ;
+ ->where('url', $url)->count();
}
return false;