From 3deb34476281a499362846c81ddabce8c633feb7 Mon Sep 17 00:00:00 2001 From: mike Date: Thu, 28 Dec 2023 02:10:41 +0100 Subject: [PATCH 1/4] Add php version to matrix github action --- .github/workflows/php_test.yml | 2 +- .../ExchangeRates/PullExchangeRates.php | 6 +- .../SendApplicationNotification.php | 2 +- app/Console/Commands/Setup/SetupApp.php | 18 ++-- .../AssociatePersonasToTransactions.php | 20 ++-- .../CategorizeAllTransactionsDebug.php | 32 ++++--- .../CopyDecimalVolumeToCalculationVolume.php | 16 ++-- .../Transaction/CreateSettingsForUsers.php | 12 ++- .../Transaction/SetAccountSaldoForUser.php | 12 ++- .../Transaction/ShowTransactionsPersonas.php | 4 +- .../UpdateTypesBasedOnRawVolume.php | 16 ++-- app/Console/Kernel.php | 2 +- .../ApplicationNotificationSent.php | 3 +- .../Category/ImportCategorizationFinished.php | 4 +- app/Exceptions/Handler.php | 14 ++- app/Filters/Filter.php | 4 +- .../Controllers/Api/Auth/UserController.php | 18 ++-- .../FileExplorer/FileExplorerController.php | 21 +++-- .../Notification/NotificationController.php | 10 +- .../Api/Profile/ProfileController.php | 4 +- .../SynchronizationController.php | 9 +- .../Analytics/AnalyticsController.php | 4 +- .../Api/Transaction/ReportController.php | 16 +++- .../Auth/ConfirmablePasswordController.php | 13 ++- .../Controllers/Web/Auth/DeviceController.php | 4 +- .../Web/Auth/NewPasswordController.php | 14 ++- .../Web/Auth/PasswordController.php | 12 ++- .../Web/Auth/PasswordResetLinkController.php | 8 +- .../Web/Auth/ProfileController.php | 12 ++- .../Web/Auth/RegisteredUserController.php | 12 ++- .../Controllers/Web/Auth/SetupController.php | 10 +- .../ExchangeRates/ExchangeRateController.php | 4 +- .../Controllers/Web/File/FileController.php | 9 +- .../Web/Import/ImportController.php | 4 +- .../Web/Import/ImportSettingController.php | 3 +- .../Institution/InstitutionController.php | 6 +- .../Notification/NotificationController.php | 3 +- .../Controllers/Web/Social/ChatController.php | 3 +- .../SynchronizationController.php | 4 +- .../Web/Transaction/BudgetController.php | 3 +- .../Categorize/CategorizationController.php | 3 +- .../Web/Transaction/CategoryController.php | 2 +- .../Web/Transaction/PersonaController.php | 16 +++- .../Transaction/PersonalAccountController.php | 24 +++-- .../Web/Transaction/ReportController.php | 4 +- .../Web/Transaction/SettingsController.php | 10 +- .../Web/Transaction/TransactionController.php | 17 ++-- .../Controllers/Web/User/UserController.php | 6 +- .../CheckOneTimeRegistrationToken.php | 4 +- .../Middleware/DenyAccessForBlockedUsers.php | 6 +- .../Middleware/RedirectIfAuthenticated.php | 2 +- .../Web/Admin/Notifications/SendRequest.php | 6 +- app/Http/Requests/Web/Auth/LoginRequest.php | 18 ++-- .../Web/Transaction/Budget/PatchRequest.php | 6 +- .../HasJsonFailedValidationResponse.php | 6 +- app/Imports/TransactionsImport.php | 9 +- app/Jobs/Auth/CreateUserSettings.php | 4 +- .../Transaction/CategorizeTransactions.php | 3 +- .../RecategorizeAllTransactions.php | 4 +- .../ResolveTransactionCalculationVolume.php | 10 +- .../SaveTransactionCategoryReference.php | 4 +- .../UpdateUsersPersonalAccountSaldo.php | 4 +- .../Auth/HandleWhenDeviceHijacked.php | 8 +- app/Mixins/AssertableJsonMixin.php | 4 +- app/Mixins/FactoryMixin.php | 8 +- app/Mixins/RouteMixin.php | 19 ++-- app/Models/Auth/Settings.php | 2 +- app/Models/ExchangeRates/ExchangeRate.php | 8 +- app/Models/File.php | 6 +- app/Models/Import/ColumnsMapping.php | 8 +- app/Models/Import/Import.php | 4 +- app/Models/Import/ImportSetting.php | 8 +- app/Models/Nordigen/EndUserAgreement.php | 14 +-- app/Models/Nordigen/Requisition.php | 6 +- app/Models/Notification.php | 4 +- app/Models/Synchronization/Account.php | 8 +- .../Synchronization/Synchronization.php | 6 +- app/Models/Transaction/Category.php | 2 +- app/Models/Transaction/Persona.php | 6 +- app/Models/Transaction/PersonalAccount.php | 2 +- app/Models/Transaction/Transaction.php | 28 +++--- app/Models/User.php | 6 +- app/Observers/Import/ImportObserver.php | 6 +- .../Transaction/TransactionObserver.php | 2 +- app/Providers/BroadcastServiceProvider.php | 2 +- app/Providers/HorizonServiceProvider.php | 14 ++- app/Providers/RouteServiceProvider.php | 22 +++-- app/Providers/TelescopeServiceProvider.php | 34 ++++--- app/Services/Analytics/AnalyticsService.php | 4 +- .../ChartQueries/CategoriesPercentage.php | 16 ++-- .../ChartQueries/CategorizedPercentage.php | 6 +- .../Traits/UseGenerateSimilarColors.php | 12 ++- app/Services/Auth/Api/UserService.php | 4 +- app/Services/Auth/Device/DeviceService.php | 4 +- .../OneTimeToken/TokenRegistrationService.php | 4 +- .../HistoricalExchangeRateDataObject.php | 3 +- .../ExchangeRates/ExchangeRatesService.php | 16 +++- .../Provider/ExchangeRatesServiceProvider.php | 18 ++-- app/Services/File/FileUploadService.php | 9 +- .../RegistersFileInDBAndStoresOnDisk.php | 10 +- app/Services/File/TransactionFileService.php | 4 +- .../FileExplorer/DirectoryRenderBuilder.php | 12 ++- .../FileExplorer/FileRenderBuilder.php | 24 +++-- app/Services/Helpers/StringHelper.php | 9 +- app/Services/Helpers/TimeHelper.php | 8 +- app/Services/Home/HomePageService.php | 9 +- .../Home/HomePageServiceCachingDecorator.php | 3 +- app/Services/Import/ImportService.php | 14 ++- app/Services/Meta/MetaService.php | 13 ++- .../DataObjects/TransactionDataObject.php | 47 ++++++---- app/Services/Nordigen/NordigenService.php | 93 ++++++++++++------- .../Provider/NordigenServiceProvider.php | 16 ++-- .../NotificationBroadcastService.php | 12 ++- .../Budget/BudgetConsumtptionService.php | 10 +- .../Transaction/Budget/BudgetService.php | 9 +- .../Categorize/CategorizationService.php | 7 +- .../Categorize/CategoryReferenceService.php | 8 +- .../TransactionCategorizeService.php | 10 +- .../Category/CategorizeTransactionService.php | 26 ++++-- .../PersonalAccountService.php | 11 ++- .../PersonalAccount/SaldoService.php | 4 +- .../Transaction/Report/ReportService.php | 18 ++-- .../Settings/UserSettingsService.php | 6 +- .../Similar/SimilarTransactionsService.php | 9 +- .../SynchronizationService.php | 8 +- .../Transaction/TransactionPersonaService.php | 64 ++++++++----- .../Transaction/TransactionService.php | 7 +- .../Transformers/DateGroupByToCalendar.php | 32 ++++--- composer.json | 3 +- composer.lock | 85 ++++++++++++++++- config/app.php | 6 +- config/database.php | 6 +- config/sanctum.php | 14 ++- database/factories/Import/ImportFactory.php | 6 +- .../Transaction/TransactionFactory.php | 6 +- database/factories/UserFactory.php | 12 ++- .../2014_10_12_000000_create_users_table.php | 20 ++-- ...000_create_password_reset_tokens_table.php | 12 ++- ..._08_19_000000_create_failed_jobs_table.php | 20 ++-- ...01_create_personal_access_tokens_table.php | 22 +++-- ...06_210329_create_import_settings_table.php | 24 ++--- .../2023_04_06_210330_create_files_table.php | 26 +++--- ...7_113635_create_columns_mappings_table.php | 26 +++--- ...2023_04_07_113636_create_imports_table.php | 42 +++++---- ...04_07_134640_create_transactions_table.php | 42 +++++---- ...ate_nordigen_end_user_agreements_table.php | 22 +++-- ...907_create_nordigen_requisitions_table.php | 32 ++++--- ...0_225503_create_synchronizations_table.php | 10 +- ...023_04_10_225930_create_accounts_table.php | 12 ++- ..._230033_create_personal_accounts_table.php | 22 +++-- ...sonal_account_id_to_transactions_table.php | 24 +++-- ...port_id_nullable_at_transactions_table.php | 28 +++--- ..._synchronization_id_column_to_accounts.php | 24 +++-- ..._add_status_column_to_synchronizations.php | 20 ++-- ..._13_115538_create_exchange_rates_table.php | 16 ++-- ...4_13_123017_add_rate_to_exchange_rates.php | 16 ++-- ...add_calculation_volume_to_transactions.php | 16 ++-- ...5233_add_synchronization_id_to_imports.php | 24 +++-- ...ake_file_id_column_nullable_at_imports.php | 28 +++--- ...sactions_statistics_columns_to_imports.php | 16 ++-- ...64514_make_columns_nullable_at_imports.php | 20 ++-- ...023_04_27_202046_create_personas_table.php | 14 +-- ...4_add_personas_columns_to_transactions.php | 40 ++++---- ..._sender_account_number_to_transactions.php | 16 ++-- ...eceiver_account_number_to_transactions.php | 16 ++-- ..._103943_add_account_number_to_personas.php | 16 ++-- ...rs_columns_indexes_to_columns_mappings.php | 20 ++-- ...2023_04_28_190306_create_reports_table.php | 12 ++- ...5_02_052307_create_report_fields_table.php | 26 +++--- ...arent_report_field_id_to_report_fields.php | 26 +++--- ...5_07_212854_create_notifications_table.php | 34 +++---- ..._21_130609_add_user_id_to_transactions.php | 22 +++-- ...131546_add_user_id_to_synchronizations.php | 22 +++-- ...2_add_user_id_to_nordigen_requisitions.php | 22 +++-- ...3_05_21_132635_add_user_id_to_accounts.php | 22 +++-- ...2023_05_21_133012_add_user_id_to_files.php | 22 +++-- ...133551_add_user_id_to_columns_mappings.php | 22 +++-- ...23_05_21_133809_add_user_id_to_imports.php | 22 +++-- ...ser_id_to_nordigen_end_user_agreements.php | 22 +++-- ..._144237_add_user_id_to_import_settings.php | 22 +++-- ...023_05_23_110548_add_is_admin_to_users.php | 16 ++-- .../2023_05_25_213554_create_jobs_table.php | 20 ++-- ...023_05_26_171457_create_settings_table.php | 24 ++--- ...3_05_26_193636_create_categories_table.php | 12 ++- ...193833_add_category_id_to_transactions.php | 24 +++-- ..._05_27_122301_create_job_batches_table.php | 26 +++--- ...2023_05_28_170228_create_budgets_table.php | 32 ++++--- ...3_06_01_102325_add_is_blocked_to_users.php | 16 ++-- ...05_104930_add_code_to_synchronizations.php | 16 ++-- ...de_column_nullable_at_synchronizations.php | 28 +++--- ..._16_015635_add_color_hex_to_categories.php | 16 ++-- ...change_amount_column_length_at_budgets.php | 28 +++--- ...lculation_column_to_transactions_table.php | 20 ++-- .../seeders/ColumnsMappingsTableSeeder.php | 6 +- database/seeders/DatabaseSeeder.php | 6 +- database/seeders/FilesTableSeeder.php | 6 +- database/seeders/UsersTableSeeder.php | 18 ++-- resources/js/getCookie.js | 6 +- tailwind.config.js | 4 +- 199 files changed, 1744 insertions(+), 1077 deletions(-) diff --git a/.github/workflows/php_test.yml b/.github/workflows/php_test.yml index 1b740b5..8ca9683 100644 --- a/.github/workflows/php_test.yml +++ b/.github/workflows/php_test.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - php: ['8.2'] + php: ['8.2', '8.3'] steps: - uses: actions/checkout@v1 diff --git a/app/Console/Commands/ExchangeRates/PullExchangeRates.php b/app/Console/Commands/ExchangeRates/PullExchangeRates.php index 7bdc4c0..6e3e245 100644 --- a/app/Console/Commands/ExchangeRates/PullExchangeRates.php +++ b/app/Console/Commands/ExchangeRates/PullExchangeRates.php @@ -33,9 +33,11 @@ public function handle(ExchangeRatesServiceInterface $exchangeRatesService): voi $line = "Exchanging $transaction->currency to $defaultCurrency: $exchangeRate->rate * $transaction->decimal_volume = $result"; $this->line($line); - $transaction->update([ + $transaction->update( + [ 'calculation_volume' => $exchangeRate->rate * $transaction->decimal_volume - ]); + ] + ); } } } diff --git a/app/Console/Commands/Notification/SendApplicationNotification.php b/app/Console/Commands/Notification/SendApplicationNotification.php index 0266cd0..563b993 100644 --- a/app/Console/Commands/Notification/SendApplicationNotification.php +++ b/app/Console/Commands/Notification/SendApplicationNotification.php @@ -20,7 +20,7 @@ public function handle(NotificationBroadcastService $notificationBroadcastServic $notificationBroadcastService->sendStoredApplicationNotification( header: $header, - content: $content , + content: $content, url: $url, userId: $userId, ); diff --git a/app/Console/Commands/Setup/SetupApp.php b/app/Console/Commands/Setup/SetupApp.php index ec1a010..2eb3b6b 100644 --- a/app/Console/Commands/Setup/SetupApp.php +++ b/app/Console/Commands/Setup/SetupApp.php @@ -151,9 +151,11 @@ private function migrateDatabase(): void { $this->info('Migrating database...'); - $exitCode = Artisan::call('migrate', [ + $exitCode = Artisan::call( + 'migrate', [ '--force' => true, - ]); + ] + ); if ($exitCode === 0) { $this->info('Database migrated.'); @@ -171,9 +173,11 @@ private function seedDatabase(): void { $this->info('Seeding database...'); - $exitCode = Artisan::call('db:seed', [ + $exitCode = Artisan::call( + 'db:seed', [ '--force' => true, - ]); + ] + ); if ($exitCode === 0) { $this->info('Database seeded.'); @@ -191,10 +195,12 @@ private function performPostSetupCommands(): void { $this->info('Performing post setup commands...'); - $exitCode = array_sum([ + $exitCode = array_sum( + [ Artisan::call('moneypenny:create-users-personal-accounts'), Artisan::call('moneypenny:create-users-settings') - ]); + ] + ); if ($exitCode === 0) { $this->info('Post setup task performed.'); diff --git a/app/Console/Commands/Transaction/AssociatePersonasToTransactions.php b/app/Console/Commands/Transaction/AssociatePersonasToTransactions.php index 6927715..dfa4ec3 100644 --- a/app/Console/Commands/Transaction/AssociatePersonasToTransactions.php +++ b/app/Console/Commands/Transaction/AssociatePersonasToTransactions.php @@ -14,7 +14,9 @@ class AssociatePersonasToTransactions extends Command protected $description = 'Create personas associations for all transactions.'; - /** @noinspection PhpUndefinedMethodInspection */ + /** + * @noinspection PhpUndefinedMethodInspection + */ public function handle(): void { $transactionsCount = Transaction::count(); @@ -22,9 +24,11 @@ public function handle(): void $this->line("Creating associations for $transactionsCount transactions..."); $this->line("* * * * * * * * * * * * * * * * * * * * * * *"); - $this->withProgressBar(Transaction::cursor(), function (Transaction $transaction) { - $this->performTask($transaction); - }); + $this->withProgressBar( + Transaction::cursor(), function (Transaction $transaction) { + $this->performTask($transaction); + } + ); $this->info(PHP_EOL . 'Found personas list:'); @@ -32,14 +36,18 @@ public function handle(): void $personas = Persona::withCount('transactionsAsSender', 'transactionsAsReceiver')->get(); foreach ($personas as $persona) { - /** @var Persona $persona */ + /** + * @var Persona $persona +*/ $associatedNamesCount = count(json_decode($persona->associated_names, true)); $commonNameOutput = trim(StringHelper::shortenAuto($persona->common_name, 25)); $associatedNamesOutput = "$associatedNamesCount : "; $associatedNamesOutput .= trim(StringHelper::shortenAuto($persona->associated_names, 45)); $accountNumberOutput = $persona->account_number; - /** @noinspection PhpUndefinedFieldInspection */ + /** + * @noinspection PhpUndefinedFieldInspection +*/ $personasData[] = [ 'common_name' => $commonNameOutput, 'associated_names' => $associatedNamesOutput, diff --git a/app/Console/Commands/Transaction/CategorizeAllTransactionsDebug.php b/app/Console/Commands/Transaction/CategorizeAllTransactionsDebug.php index bf44224..22a59b6 100644 --- a/app/Console/Commands/Transaction/CategorizeAllTransactionsDebug.php +++ b/app/Console/Commands/Transaction/CategorizeAllTransactionsDebug.php @@ -42,22 +42,26 @@ public function handle(CategorizeTransactionService $categorizeTransactionServic $chunkCounter = 0; $transactionBaseQuery - ->chunk($chunkSize, function (Collection $transactions) use ($categorizeTransactionService, &$chunkCounter) { - try { - $categorizedPercentage = $categorizeTransactionService->categorizeTransactionsSync($transactions); - ++$chunkCounter; - $categorizedFormatted = number_format($categorizedPercentage * 100, 1); - $line = '[' . $chunkCounter . '] Processed chunk. ' . $categorizedFormatted . '% categorized.'; - $this->line($line); - - } catch (Throwable $throwable) { - $this->error('[' . $chunkCounter . '] Processed chunk failed'); - $shortMessage = StringHelper::shortenAuto($throwable->getMessage(), 200); - $this->warn($shortMessage); + ->chunk( + $chunkSize, function (Collection $transactions) use ($categorizeTransactionService, &$chunkCounter) { + try { + $categorizedPercentage = $categorizeTransactionService->categorizeTransactionsSync($transactions); + ++$chunkCounter; + $categorizedFormatted = number_format($categorizedPercentage * 100, 1); + $line = '[' . $chunkCounter . '] Processed chunk. ' . $categorizedFormatted . '% categorized.'; + $this->line($line); + + } catch (Throwable $throwable) { + $this->error('[' . $chunkCounter . '] Processed chunk failed'); + $shortMessage = StringHelper::shortenAuto($throwable->getMessage(), 200); + $this->warn($shortMessage); + } } - }); + ); - /** @noinspection PhpUndefinedMethodInspection */ + /** + * @noinspection PhpUndefinedMethodInspection +*/ $categorizedTransactionsCount = Transaction::whereNotNull('category_id')->count(); $totalCategorizedPercentage = number_format( ($categorizedTransactionsCount / $transactionsTotalCount) * 100, diff --git a/app/Console/Commands/Transaction/CopyDecimalVolumeToCalculationVolume.php b/app/Console/Commands/Transaction/CopyDecimalVolumeToCalculationVolume.php index 436342e..2f5f5cb 100644 --- a/app/Console/Commands/Transaction/CopyDecimalVolumeToCalculationVolume.php +++ b/app/Console/Commands/Transaction/CopyDecimalVolumeToCalculationVolume.php @@ -14,12 +14,16 @@ class CopyDecimalVolumeToCalculationVolume extends Command public function handle(): void { - DB::transaction(function() { - foreach (Transaction::cursor() as $transaction) { - $transaction->update([ - 'calculation_volume' => $transaction->decimal_volume - ]); + DB::transaction( + function () { + foreach (Transaction::cursor() as $transaction) { + $transaction->update( + [ + 'calculation_volume' => $transaction->decimal_volume + ] + ); + } } - }); + ); } } diff --git a/app/Console/Commands/Transaction/CreateSettingsForUsers.php b/app/Console/Commands/Transaction/CreateSettingsForUsers.php index a3ecac5..58dc208 100644 --- a/app/Console/Commands/Transaction/CreateSettingsForUsers.php +++ b/app/Console/Commands/Transaction/CreateSettingsForUsers.php @@ -17,12 +17,16 @@ public function handle(): int $this->info("Creating settings for existing users..."); foreach (User::cursor() as $user) { - /** @var User $user */ - Settings::firstOrCreate([ + /** + * @var User $user +*/ + Settings::firstOrCreate( + [ 'user_id' => $user->id - ], [ + ], [ 'base_currency_code' => config('moneypenny.base_calculation_currency') - ]); + ] + ); } $this->info('Success.'); diff --git a/app/Console/Commands/Transaction/SetAccountSaldoForUser.php b/app/Console/Commands/Transaction/SetAccountSaldoForUser.php index 662aea4..3fe5877 100644 --- a/app/Console/Commands/Transaction/SetAccountSaldoForUser.php +++ b/app/Console/Commands/Transaction/SetAccountSaldoForUser.php @@ -26,14 +26,18 @@ public function handle(): int $value = $this->ask('Type in value (eg. 3500.00): '); $floatValue = floatval($value); - $personalAccount = PersonalAccount::firstWhere([ + $personalAccount = PersonalAccount::firstWhere( + [ 'user_id' => $user->id, 'name' => 'Default' - ]); + ] + ); - $personalAccount = tap($personalAccount)->update([ + $personalAccount = tap($personalAccount)->update( + [ 'value' => $floatValue - ]); + ] + ); $this->info("Saldo value updated: " . $personalAccount->value . 'PLN'); diff --git a/app/Console/Commands/Transaction/ShowTransactionsPersonas.php b/app/Console/Commands/Transaction/ShowTransactionsPersonas.php index 89dff1f..e78ac01 100644 --- a/app/Console/Commands/Transaction/ShowTransactionsPersonas.php +++ b/app/Console/Commands/Transaction/ShowTransactionsPersonas.php @@ -37,7 +37,9 @@ private function performTask(): array $transactionsPersonasData = []; foreach ($transactionsCursor as $transaction) { - /** @var Transaction $transaction */ + /** + * @var Transaction $transaction +*/ $spCommonName = $transaction->senderPersona?->common_name ?? ''; $rpCommonName = $transaction->receiverPersona?->common_name ?? ''; $sender = $transaction->sender ?? ''; diff --git a/app/Console/Commands/Transaction/UpdateTypesBasedOnRawVolume.php b/app/Console/Commands/Transaction/UpdateTypesBasedOnRawVolume.php index 0553bf6..fb70f8a 100644 --- a/app/Console/Commands/Transaction/UpdateTypesBasedOnRawVolume.php +++ b/app/Console/Commands/Transaction/UpdateTypesBasedOnRawVolume.php @@ -13,15 +13,17 @@ class UpdateTypesBasedOnRawVolume extends Command public function handle(): void { - $this->withProgressBar(Transaction::cursor(), function(Transaction $transaction) { - $rawVolume = $transaction->raw_volume; + $this->withProgressBar( + Transaction::cursor(), function (Transaction $transaction) { + $rawVolume = $transaction->raw_volume; - if (str_starts_with($rawVolume, '-')) { - $transaction->update(['type' => Transaction::TYPE_EXPENDITURE]); - } else { - $transaction->update(['type' => Transaction::TYPE_INCOME]); + if (str_starts_with($rawVolume, '-')) { + $transaction->update(['type' => Transaction::TYPE_EXPENDITURE]); + } else { + $transaction->update(['type' => Transaction::TYPE_INCOME]); + } } - }); + ); $this->info(PHP_EOL . 'Transactions types updated successfully.'); } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index bbf1810..f0245e9 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -23,6 +23,6 @@ protected function commands(): void { $this->load(__DIR__.'/Commands'); - require base_path('routes/console.php'); + include base_path('routes/console.php'); } } diff --git a/app/Events/Notification/ApplicationNotificationSent.php b/app/Events/Notification/ApplicationNotificationSent.php index e56c4d8..a5535b5 100644 --- a/app/Events/Notification/ApplicationNotificationSent.php +++ b/app/Events/Notification/ApplicationNotificationSent.php @@ -16,8 +16,7 @@ public function __construct( public string $header, public string $message, public string $url - ) - { + ) { } public function broadcastAs(): string diff --git a/app/Events/Transaction/Category/ImportCategorizationFinished.php b/app/Events/Transaction/Category/ImportCategorizationFinished.php index 032e9c9..3980879 100644 --- a/app/Events/Transaction/Category/ImportCategorizationFinished.php +++ b/app/Events/Transaction/Category/ImportCategorizationFinished.php @@ -8,5 +8,7 @@ class ImportCategorizationFinished { use Dispatchable; - public function __construct(public mixed $importId) {} + public function __construct(public mixed $importId) + { + } } diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index c597014..8faa4c9 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -49,9 +49,11 @@ class Handler extends ExceptionHandler */ public function register(): void { - $this->reportable(function (Throwable $e) { - // - }); + $this->reportable( + function (Throwable $e) { + // + } + ); } /** @@ -74,10 +76,12 @@ protected function getJsonResponse(Throwable $throwable): JsonResponse { $statusCode = $this->getExceptionHTTPStatusCode($throwable); - return new JsonResponse([ + return new JsonResponse( + [ 'status' => $statusCode, 'message' => $throwable->getMessage() - ], $statusCode); + ], $statusCode + ); } protected function getExceptionHTTPStatusCode(Throwable $throwable): int diff --git a/app/Filters/Filter.php b/app/Filters/Filter.php index 82d77b1..23e29ef 100644 --- a/app/Filters/Filter.php +++ b/app/Filters/Filter.php @@ -51,7 +51,9 @@ public function applyOnQuery(Builder $builder): Builder return $builder; } - /** @var Filterable|Model $model */ + /** + * @var Filterable|Model $model +*/ $model = $builder->getModel(); $filterableColumns = $model::getFilterableColumns()->toArray(); diff --git a/app/Http/Controllers/Api/Auth/UserController.php b/app/Http/Controllers/Api/Auth/UserController.php index c0a8194..f5e52fb 100644 --- a/app/Http/Controllers/Api/Auth/UserController.php +++ b/app/Http/Controllers/Api/Auth/UserController.php @@ -33,9 +33,11 @@ public function login(LoginRequest $request): Response ); } catch (Throwable) { - return response([ + return response( + [ 'message' => 'Bad credential provided!', - ], 401); + ], 401 + ); } return response($result); @@ -45,16 +47,20 @@ public function logout(Request $request): Response { $this->userService->logout($request->user()); - return response([ + return response( + [ 'message' => 'User logged out successfully.', - ]); + ] + ); } public function user(Request $request): Response { - return response([ + return response( + [ 'user' => $request->user(), 'token' => $request->bearerToken(), - ]); + ] + ); } } diff --git a/app/Http/Controllers/Api/FileExplorer/FileExplorerController.php b/app/Http/Controllers/Api/FileExplorer/FileExplorerController.php index 89c69ad..7e158af 100644 --- a/app/Http/Controllers/Api/FileExplorer/FileExplorerController.php +++ b/app/Http/Controllers/Api/FileExplorer/FileExplorerController.php @@ -16,7 +16,8 @@ class FileExplorerController extends Controller public function __construct( private readonly FileRenderBuilder $fileRenderBuilder, private readonly DirectoryRenderBuilder $directoryRenderBuilder - ) {} + ) { + } public function get(Request $request): StreamedResponse { @@ -35,17 +36,21 @@ public function show(Request $request): JsonResponse ->build(); } catch (NotFoundHttpException $exception) { - return response()->json([ + return response()->json( + [ 'exists' => false, 'message' => $exception->getMessage(), - ], 404); + ], 404 + ); } - return response()->json([ + return response()->json( + [ 'exists' => true, 'file_type' => $fileRender->getFileType(), 'render' => $fileRender->getRenderedFile() - ]); + ] + ); } public function open(Request $request): JsonResponse @@ -57,9 +62,11 @@ public function open(Request $request): JsonResponse ->setTargetPath($targetPath) ->build(); - return response()->json([ + return response()->json( + [ 'requested_path' => $targetPath, 'render' => $directoryRender->getRenderedDirectory() - ]); + ] + ); } } diff --git a/app/Http/Controllers/Api/Notification/NotificationController.php b/app/Http/Controllers/Api/Notification/NotificationController.php index dd9d561..88096b1 100644 --- a/app/Http/Controllers/Api/Notification/NotificationController.php +++ b/app/Http/Controllers/Api/Notification/NotificationController.php @@ -9,7 +9,9 @@ class NotificationController extends Controller { - public function __construct(private readonly NotificationService $notificationService) {} + public function __construct(private readonly NotificationService $notificationService) + { + } public function index(Request $request): JsonResponse { @@ -17,8 +19,10 @@ public function index(Request $request): JsonResponse $limit = $request->integer('limit', 5); $notifications = $this->notificationService->all($user, $limit); - return response()->json([ + return response()->json( + [ 'notifications' => $notifications - ]); + ] + ); } } diff --git a/app/Http/Controllers/Api/Profile/ProfileController.php b/app/Http/Controllers/Api/Profile/ProfileController.php index 39c6e94..0241a51 100644 --- a/app/Http/Controllers/Api/Profile/ProfileController.php +++ b/app/Http/Controllers/Api/Profile/ProfileController.php @@ -9,7 +9,9 @@ class ProfileController extends Controller { - public function __construct(private readonly ProfileFileService $profileFileService) {} + public function __construct(private readonly ProfileFileService $profileFileService) + { + } public function selectLibraryAvatar(Request $request): JsonResponse { diff --git a/app/Http/Controllers/Api/Synchronization/SynchronizationController.php b/app/Http/Controllers/Api/Synchronization/SynchronizationController.php index 5362158..38b90d2 100644 --- a/app/Http/Controllers/Api/Synchronization/SynchronizationController.php +++ b/app/Http/Controllers/Api/Synchronization/SynchronizationController.php @@ -17,8 +17,7 @@ public function __construct( private readonly NordigenAccountService $nordigenAccountService, private readonly SynchronizationService $synchronizationService, private readonly TransactionSyncServiceInterface $transactionSyncService - ) - { + ) { } public function sync(Request $request): JsonResponse @@ -41,11 +40,13 @@ public function sync(Request $request): JsonResponse $supportedStatuses = [500, 429, 408]; $statusCode = in_array($throwable->getCode(), $supportedStatuses) ? $statusCode : 500; - return response()->json([ + return response()->json( + [ 'error' => 'Synchronization error', 'details' => App::hasDebugModeEnabled() ? $throwable->getMessage() : 'Lacking permissions', 'status_code' => $statusCode, - ], $statusCode); + ], $statusCode + ); } $accounts = $this->nordigenAccountService->all($user); diff --git a/app/Http/Controllers/Api/Transaction/Analytics/AnalyticsController.php b/app/Http/Controllers/Api/Transaction/Analytics/AnalyticsController.php index 621546a..97cd4f5 100644 --- a/app/Http/Controllers/Api/Transaction/Analytics/AnalyticsController.php +++ b/app/Http/Controllers/Api/Transaction/Analytics/AnalyticsController.php @@ -8,7 +8,9 @@ class AnalyticsController extends Controller { - public function __construct(private readonly AnalyticsService $analyticsService) {} + public function __construct(private readonly AnalyticsService $analyticsService) + { + } public function index(Request $request): array { diff --git a/app/Http/Controllers/Api/Transaction/ReportController.php b/app/Http/Controllers/Api/Transaction/ReportController.php index 2d5d5b2..e1c7388 100644 --- a/app/Http/Controllers/Api/Transaction/ReportController.php +++ b/app/Http/Controllers/Api/Transaction/ReportController.php @@ -9,7 +9,9 @@ class ReportController extends Controller { - public function __construct(private readonly ReportService $reportService) {} + public function __construct(private readonly ReportService $reportService) + { + } public function avgExpenditures(Request $request): JsonResponse { @@ -18,9 +20,11 @@ public function avgExpenditures(Request $request): JsonResponse ->reportService ->getAvgExpendituresByDays($user, sinceDate: now()->subMonth(), toDate: now()); - return response()->json([ + return response()->json( + [ 'dataset' => $data - ]); + ] + ); } public function avgIncomes(Request $request): JsonResponse @@ -30,8 +34,10 @@ public function avgIncomes(Request $request): JsonResponse ->reportService ->getAvgIncomesByDays($user, sinceDate: now()->subMonth(), toDate: now()); - return response()->json([ + return response()->json( + [ 'dataset' => $data - ]); + ] + ); } } diff --git a/app/Http/Controllers/Web/Auth/ConfirmablePasswordController.php b/app/Http/Controllers/Web/Auth/ConfirmablePasswordController.php index 12ee2f4..38d658e 100644 --- a/app/Http/Controllers/Web/Auth/ConfirmablePasswordController.php +++ b/app/Http/Controllers/Web/Auth/ConfirmablePasswordController.php @@ -25,13 +25,18 @@ public function show(): View */ public function store(Request $request): RedirectResponse { - if (! Auth::guard('web')->validate([ + if (! Auth::guard('web')->validate( + [ 'email' => $request->user()->email, 'password' => $request->password, - ])) { - throw ValidationException::withMessages([ + ] + ) + ) { + throw ValidationException::withMessages( + [ 'password' => __('auth.password'), - ]); + ] + ); } $request->session()->put('auth.password_confirmed_at', time()); diff --git a/app/Http/Controllers/Web/Auth/DeviceController.php b/app/Http/Controllers/Web/Auth/DeviceController.php index 5c2053e..8a01e20 100644 --- a/app/Http/Controllers/Web/Auth/DeviceController.php +++ b/app/Http/Controllers/Web/Auth/DeviceController.php @@ -9,7 +9,9 @@ class DeviceController extends Controller { - public function __construct(private readonly DeviceService $deviceService) {} + public function __construct(private readonly DeviceService $deviceService) + { + } public function index(Request $request): View { diff --git a/app/Http/Controllers/Web/Auth/NewPasswordController.php b/app/Http/Controllers/Web/Auth/NewPasswordController.php index ce66f09..765fa93 100644 --- a/app/Http/Controllers/Web/Auth/NewPasswordController.php +++ b/app/Http/Controllers/Web/Auth/NewPasswordController.php @@ -29,11 +29,13 @@ public function create(Request $request): View */ public function store(Request $request): RedirectResponse { - $request->validate([ + $request->validate( + [ 'token' => ['required'], 'email' => ['required', 'email'], 'password' => ['required', 'confirmed', Rules\Password::defaults()], - ]); + ] + ); // Here we will attempt to reset the user's password. If it is successful we // will update the password on an actual user model and persist it to the @@ -41,10 +43,12 @@ public function store(Request $request): RedirectResponse $status = Password::reset( $request->only('email', 'password', 'password_confirmation', 'token'), function ($user) use ($request) { - $user->forceFill([ + $user->forceFill( + [ 'password' => Hash::make($request->password), 'remember_token' => Str::random(60), - ])->save(); + ] + )->save(); event(new PasswordReset($user)); } @@ -56,6 +60,6 @@ function ($user) use ($request) { return $status == Password::PASSWORD_RESET ? redirect()->route('login')->with('status', __($status)) : back()->withInput($request->only('email')) - ->withErrors(['email' => __($status)]); + ->withErrors(['email' => __($status)]); } } diff --git a/app/Http/Controllers/Web/Auth/PasswordController.php b/app/Http/Controllers/Web/Auth/PasswordController.php index 4fcca3d..1ea6cc3 100644 --- a/app/Http/Controllers/Web/Auth/PasswordController.php +++ b/app/Http/Controllers/Web/Auth/PasswordController.php @@ -15,14 +15,18 @@ class PasswordController extends Controller */ public function update(Request $request): RedirectResponse { - $validated = $request->validateWithBag('updatePassword', [ + $validated = $request->validateWithBag( + 'updatePassword', [ 'current_password' => ['required', 'current_password'], 'password' => ['required', Password::defaults(), 'confirmed'], - ]); + ] + ); - $request->user()->update([ + $request->user()->update( + [ 'password' => Hash::make($validated['password']), - ]); + ] + ); return back()->with('status', 'password-updated'); } diff --git a/app/Http/Controllers/Web/Auth/PasswordResetLinkController.php b/app/Http/Controllers/Web/Auth/PasswordResetLinkController.php index 43376d3..1820e01 100644 --- a/app/Http/Controllers/Web/Auth/PasswordResetLinkController.php +++ b/app/Http/Controllers/Web/Auth/PasswordResetLinkController.php @@ -25,9 +25,11 @@ public function create(): View */ public function store(Request $request): RedirectResponse { - $request->validate([ + $request->validate( + [ 'email' => ['required', 'email'], - ]); + ] + ); // We will send the password reset link to this user. Once we have attempted // to send the link, we will examine the response then see the message we @@ -39,6 +41,6 @@ public function store(Request $request): RedirectResponse return $status == Password::RESET_LINK_SENT ? back()->with('status', __($status)) : back()->withInput($request->only('email')) - ->withErrors(['email' => __($status)]); + ->withErrors(['email' => __($status)]); } } diff --git a/app/Http/Controllers/Web/Auth/ProfileController.php b/app/Http/Controllers/Web/Auth/ProfileController.php index fe3fffe..a16658f 100644 --- a/app/Http/Controllers/Web/Auth/ProfileController.php +++ b/app/Http/Controllers/Web/Auth/ProfileController.php @@ -17,9 +17,11 @@ class ProfileController extends Controller */ public function edit(Request $request): View { - return view('profile.edit', [ + return view( + 'profile.edit', [ 'user' => $request->user(), - ]); + ] + ); } /** @@ -43,9 +45,11 @@ public function update(UpdateRequest $request): RedirectResponse */ public function destroy(Request $request): RedirectResponse { - $request->validateWithBag('userDeletion', [ + $request->validateWithBag( + 'userDeletion', [ 'password' => ['required', 'current_password'], - ]); + ] + ); $user = $request->user(); diff --git a/app/Http/Controllers/Web/Auth/RegisteredUserController.php b/app/Http/Controllers/Web/Auth/RegisteredUserController.php index 89f4b80..b26e2fe 100644 --- a/app/Http/Controllers/Web/Auth/RegisteredUserController.php +++ b/app/Http/Controllers/Web/Auth/RegisteredUserController.php @@ -30,17 +30,21 @@ public function create(): View */ public function store(Request $request): RedirectResponse { - $request->validate([ + $request->validate( + [ 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:'.User::class], 'password' => ['required', 'confirmed', Rules\Password::defaults()], - ]); + ] + ); - $user = User::create([ + $user = User::create( + [ 'name' => $request->name, 'email' => $request->email, 'password' => Hash::make($request->password), - ]); + ] + ); event(new Registered($user)); diff --git a/app/Http/Controllers/Web/Auth/SetupController.php b/app/Http/Controllers/Web/Auth/SetupController.php index 0ac8169..fd7115b 100644 --- a/app/Http/Controllers/Web/Auth/SetupController.php +++ b/app/Http/Controllers/Web/Auth/SetupController.php @@ -9,15 +9,19 @@ class SetupController extends Controller { - public function __construct(private readonly UserService $userService) {} + public function __construct(private readonly UserService $userService) + { + } public function setup(Request $request): View { $apiToken = $this->userService->getOrCreateApiToken($request->user()); - return view('auth.setup', [ + return view( + 'auth.setup', [ 'redirect' => route('setting.edit'), 'currentApiToken' => $apiToken - ]); + ] + ); } } diff --git a/app/Http/Controllers/Web/ExchangeRates/ExchangeRateController.php b/app/Http/Controllers/Web/ExchangeRates/ExchangeRateController.php index babca75..bd215b9 100644 --- a/app/Http/Controllers/Web/ExchangeRates/ExchangeRateController.php +++ b/app/Http/Controllers/Web/ExchangeRates/ExchangeRateController.php @@ -8,7 +8,9 @@ class ExchangeRateController extends Controller { - public function __construct(private readonly ExchangeRatesService $exchangeRatesService) {} + public function __construct(private readonly ExchangeRatesService $exchangeRatesService) + { + } public function index(): View { diff --git a/app/Http/Controllers/Web/File/FileController.php b/app/Http/Controllers/Web/File/FileController.php index d01d921..e26f651 100644 --- a/app/Http/Controllers/Web/File/FileController.php +++ b/app/Http/Controllers/Web/File/FileController.php @@ -20,8 +20,7 @@ public function __construct( private readonly FileUploadService $fileUploadService, private readonly ColumnMappingService $columnMappingService, private readonly ImportSettingService $importSettingService - ) - { + ) { } public function index(Request $request): View @@ -36,9 +35,11 @@ public function index(Request $request): View public function show(mixed $id, Request $request): View { - return view('file.show', [ + return view( + 'file.show', [ 'file' => $this->fileService->findOrFail($id, $request->user()), - ]); + ] + ); } /** diff --git a/app/Http/Controllers/Web/Import/ImportController.php b/app/Http/Controllers/Web/Import/ImportController.php index a9e9ff1..1456aa5 100644 --- a/app/Http/Controllers/Web/Import/ImportController.php +++ b/app/Http/Controllers/Web/Import/ImportController.php @@ -9,7 +9,9 @@ class ImportController extends Controller { - public function __construct(private readonly ImportService $importService) {} + public function __construct(private readonly ImportService $importService) + { + } public function index(Request $request): View { diff --git a/app/Http/Controllers/Web/Import/ImportSettingController.php b/app/Http/Controllers/Web/Import/ImportSettingController.php index 97f28b4..b27d463 100644 --- a/app/Http/Controllers/Web/Import/ImportSettingController.php +++ b/app/Http/Controllers/Web/Import/ImportSettingController.php @@ -17,7 +17,8 @@ class ImportSettingController extends Controller public function __construct( private readonly ImportService $importService, private readonly ImportSettingService $importSettingService - ) {} + ) { + } public function index(Request $request): View { diff --git a/app/Http/Controllers/Web/Nordigen/Institution/InstitutionController.php b/app/Http/Controllers/Web/Nordigen/Institution/InstitutionController.php index 842f387..696017e 100644 --- a/app/Http/Controllers/Web/Nordigen/Institution/InstitutionController.php +++ b/app/Http/Controllers/Web/Nordigen/Institution/InstitutionController.php @@ -26,9 +26,11 @@ public function index(Request $request): View|RedirectResponse } catch (Throwable) { return back() - ->with(config('session.flash_errors_key'), [ + ->with( + config('session.flash_errors_key'), [ __('Cannot fetch institutions data.') - ]); + ] + ); } } diff --git a/app/Http/Controllers/Web/Notification/NotificationController.php b/app/Http/Controllers/Web/Notification/NotificationController.php index 1293250..a6860b4 100644 --- a/app/Http/Controllers/Web/Notification/NotificationController.php +++ b/app/Http/Controllers/Web/Notification/NotificationController.php @@ -17,7 +17,8 @@ class NotificationController extends Controller public function __construct( private readonly NotificationService $notificationService, private readonly NotificationBroadcastService $notificationBroadcastService - ) {} + ) { + } public function index(Request $request): View { diff --git a/app/Http/Controllers/Web/Social/ChatController.php b/app/Http/Controllers/Web/Social/ChatController.php index e1c94d7..7c5fcec 100644 --- a/app/Http/Controllers/Web/Social/ChatController.php +++ b/app/Http/Controllers/Web/Social/ChatController.php @@ -16,7 +16,8 @@ class ChatController extends Controller public function __construct( private readonly CacheAdapterInterface $cacheAdapter, private readonly NotificationBroadcastService $notificationBroadcastService - ) {} + ) { + } public function index(): View { diff --git a/app/Http/Controllers/Web/Synchronization/SynchronizationController.php b/app/Http/Controllers/Web/Synchronization/SynchronizationController.php index 69a2a82..ec4ea7f 100644 --- a/app/Http/Controllers/Web/Synchronization/SynchronizationController.php +++ b/app/Http/Controllers/Web/Synchronization/SynchronizationController.php @@ -9,7 +9,9 @@ class SynchronizationController extends Controller { - public function __construct(private readonly SynchronizationService $synchronizationService) {} + public function __construct(private readonly SynchronizationService $synchronizationService) + { + } public function index(Request $request): View { diff --git a/app/Http/Controllers/Web/Transaction/BudgetController.php b/app/Http/Controllers/Web/Transaction/BudgetController.php index 7193910..b440427 100644 --- a/app/Http/Controllers/Web/Transaction/BudgetController.php +++ b/app/Http/Controllers/Web/Transaction/BudgetController.php @@ -16,7 +16,8 @@ class BudgetController extends Controller public function __construct( private readonly BudgetService $budgetService, private readonly CurrencyService $currencyService - ) {} + ) { + } public function index(Request $request): View { diff --git a/app/Http/Controllers/Web/Transaction/Categorize/CategorizationController.php b/app/Http/Controllers/Web/Transaction/Categorize/CategorizationController.php index bf947d8..97e3c39 100644 --- a/app/Http/Controllers/Web/Transaction/Categorize/CategorizationController.php +++ b/app/Http/Controllers/Web/Transaction/Categorize/CategorizationController.php @@ -14,7 +14,8 @@ class CategorizationController extends Controller public function __construct( private readonly CacheAdapterInterface $cacheAdapter, private readonly CategorizationService $categorizationService - ) {} + ) { + } public function index(): View { diff --git a/app/Http/Controllers/Web/Transaction/CategoryController.php b/app/Http/Controllers/Web/Transaction/CategoryController.php index 0ef7942..f9fa5f6 100644 --- a/app/Http/Controllers/Web/Transaction/CategoryController.php +++ b/app/Http/Controllers/Web/Transaction/CategoryController.php @@ -17,7 +17,7 @@ public function index(Request $request): View if (!$user->is_admin) { $baseQuery = Category::whereHas( 'transactions', fn($relation) => $relation - ->where('user_id', $user->id) + ->where('user_id', $user->id) ); } diff --git a/app/Http/Controllers/Web/Transaction/PersonaController.php b/app/Http/Controllers/Web/Transaction/PersonaController.php index cc4cb51..884bfe2 100644 --- a/app/Http/Controllers/Web/Transaction/PersonaController.php +++ b/app/Http/Controllers/Web/Transaction/PersonaController.php @@ -12,7 +12,9 @@ class PersonaController extends Controller { - public function __construct(private readonly TransactionPersonaService $transactionPersonaService) {} + public function __construct(private readonly TransactionPersonaService $transactionPersonaService) + { + } public function index(Request $request): View { @@ -24,18 +26,22 @@ public function index(Request $request): View ->get(); if (null !== $selectedPersonaId) { - return view('persona.index', [ + return view( + 'persona.index', [ 'personas' => $personas, 'selected_persona' => Persona::with( 'transactionsAsSender', 'transactionsAsReceiver' ) ->find($selectedPersonaId) - ]); + ] + ); } - return view('persona.index', [ + return view( + 'persona.index', [ 'personas' => $personas, - ]); + ] + ); } public function update(Persona $persona, Request $request): RedirectResponse diff --git a/app/Http/Controllers/Web/Transaction/PersonalAccountController.php b/app/Http/Controllers/Web/Transaction/PersonalAccountController.php index 1b39c9e..0b13471 100644 --- a/app/Http/Controllers/Web/Transaction/PersonalAccountController.php +++ b/app/Http/Controllers/Web/Transaction/PersonalAccountController.php @@ -17,9 +17,11 @@ public function index(Request $request): View ->withCount('transactions') ->get(); - return view('personal_account.index', [ + return view( + 'personal_account.index', [ 'personalAccounts' => $personalAccounts - ]); + ] + ); } public function edit(Request $request): View @@ -27,21 +29,27 @@ public function edit(Request $request): View // @todo - handle editing multiplte personal account saldos $personalAccount = $request->user()->personalAccounts()->first(); - return view('personal_account.edit', [ + return view( + 'personal_account.edit', [ 'personalAccount' => $personalAccount - ]); + ] + ); } public function update(Request $request): RedirectResponse { // @todo - handle editing multiplte personal account saldos $personalAccount = $request->user()->personalAccounts()->first(); - $request->validate([ + $request->validate( + [ 'value' => 'numeric|gte:0' - ]); - $personalAccount->update([ + ] + ); + $personalAccount->update( + [ 'value' => $request->input('value') - ]); + ] + ); return to_route('home'); } diff --git a/app/Http/Controllers/Web/Transaction/ReportController.php b/app/Http/Controllers/Web/Transaction/ReportController.php index 58051dd..1d4da7b 100644 --- a/app/Http/Controllers/Web/Transaction/ReportController.php +++ b/app/Http/Controllers/Web/Transaction/ReportController.php @@ -9,7 +9,9 @@ class ReportController extends Controller { - public function __construct(private readonly ReportService $reportService) {} + public function __construct(private readonly ReportService $reportService) + { + } public function periodic(Request $request): View { diff --git a/app/Http/Controllers/Web/Transaction/SettingsController.php b/app/Http/Controllers/Web/Transaction/SettingsController.php index 18cb384..a25991e 100644 --- a/app/Http/Controllers/Web/Transaction/SettingsController.php +++ b/app/Http/Controllers/Web/Transaction/SettingsController.php @@ -12,7 +12,9 @@ class SettingsController extends Controller { - public function __construct(private readonly NotificationBroadcastService $notificationBroadcastService) {} + public function __construct(private readonly NotificationBroadcastService $notificationBroadcastService) + { + } public function edit(Request $request): View { @@ -29,10 +31,12 @@ public function update(EditRequest $request): RedirectResponse $data = $request->validated(); $user = $request->user(); - Settings::firstOrCreate([ + Settings::firstOrCreate( + [ 'user_id' => $user->id, 'base_currency_code' => $data['base_currency_code'] - ]); + ] + ); $this->notificationBroadcastService->sendStoredApplicationNotification( header: 'Settings saved', diff --git a/app/Http/Controllers/Web/Transaction/TransactionController.php b/app/Http/Controllers/Web/Transaction/TransactionController.php index aacf919..46721f7 100644 --- a/app/Http/Controllers/Web/Transaction/TransactionController.php +++ b/app/Http/Controllers/Web/Transaction/TransactionController.php @@ -18,7 +18,8 @@ class TransactionController extends Controller public function __construct( private readonly TransactionService $transactionService, private readonly CurrencyService $currencyService - ) {} + ) { + } public function index(Request $request): View { @@ -49,10 +50,12 @@ public function create(CreateRequest $request): RedirectResponse $this->transactionService->create($user, $data); return to_route('transaction.index') - ->with(config('session.flash_messages_key'), [ + ->with( + config('session.flash_messages_key'), [ __('Added new transaction.') - ]); - } + ] + ); + } public function patch(mixed $transactionId, PatchRequest $request): RedirectResponse { @@ -69,8 +72,10 @@ public function toggleExcludeFromCalculation(mixed $transactionId): RedirectResp $this->transactionService->toggleExcludeFromCalculation($transactionId); return to_route('transaction.show', ['id' => $transaction->id]) - ->with(config('session.flash_messages_key'), [ + ->with( + config('session.flash_messages_key'), [ __('Changed transaction calculation settings.') - ]); + ] + ); } } diff --git a/app/Http/Controllers/Web/User/UserController.php b/app/Http/Controllers/Web/User/UserController.php index 509d4bd..ed7c7e1 100644 --- a/app/Http/Controllers/Web/User/UserController.php +++ b/app/Http/Controllers/Web/User/UserController.php @@ -51,7 +51,8 @@ public function show(mixed $id): View $baseCurrencyCode = Settings::whereUser($user)?->get()->first()?->base_currency_code ?? 'No data'; $devices = $this->deviceService->all($user); - return view('admin.users.show', [ + return view( + 'admin.users.show', [ 'user' => $user, 'devices' => $devices, 'baseCurrencyCode' => $baseCurrencyCode, @@ -63,7 +64,8 @@ public function show(mixed $id): View 'requisitionsCount' => $requisitionsCount, 'nordigenAccountsCount' => $nordigenAccountsCount, 'synchronizationsCount' => $synchronizationsCount - ]); + ] + ); } public function confirmRoleChange(mixed $id): View diff --git a/app/Http/Middleware/CheckOneTimeRegistrationToken.php b/app/Http/Middleware/CheckOneTimeRegistrationToken.php index 07bb502..2a90d17 100644 --- a/app/Http/Middleware/CheckOneTimeRegistrationToken.php +++ b/app/Http/Middleware/CheckOneTimeRegistrationToken.php @@ -9,7 +9,9 @@ class CheckOneTimeRegistrationToken { - public function __construct(private readonly TokenRegistrationService $tokenRegistrationService) {} + public function __construct(private readonly TokenRegistrationService $tokenRegistrationService) + { + } public function handle(Request $request, Closure $next): Response { diff --git a/app/Http/Middleware/DenyAccessForBlockedUsers.php b/app/Http/Middleware/DenyAccessForBlockedUsers.php index 2debf3b..d57f37f 100644 --- a/app/Http/Middleware/DenyAccessForBlockedUsers.php +++ b/app/Http/Middleware/DenyAccessForBlockedUsers.php @@ -12,9 +12,11 @@ public function handle(Request $request, Closure $next): Response { if ($request->user()?->isBlocked()) { if ($request->wantsJson()) { - return response()->json([ + return response()->json( + [ 'error' => 'Your account has been blocked by the system administration.' - ], 403); + ], 403 + ); } return to_route('blocked.index'); diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index afc78c4..dae8398 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -13,7 +13,7 @@ class RedirectIfAuthenticated /** * Handle an incoming request. * - * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next + * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next */ public function handle(Request $request, Closure $next, string ...$guards): Response { diff --git a/app/Http/Requests/Web/Admin/Notifications/SendRequest.php b/app/Http/Requests/Web/Admin/Notifications/SendRequest.php index eb6970d..ea1479f 100644 --- a/app/Http/Requests/Web/Admin/Notifications/SendRequest.php +++ b/app/Http/Requests/Web/Admin/Notifications/SendRequest.php @@ -17,13 +17,15 @@ public function rules(): array 'user_id' => 'nullable|exists:users,id', 'type' => [ 'nullable', - Rule::in([ + Rule::in( + [ Notification::TYPE_INFO, Notification::TYPE_ERROR, Notification::TYPE_EVENT, Notification::TYPE_SUCCESS, Notification::TYPE_WARNING - ]) + ] + ) ] ]; } diff --git a/app/Http/Requests/Web/Auth/LoginRequest.php b/app/Http/Requests/Web/Auth/LoginRequest.php index 631ee56..7eeb71a 100644 --- a/app/Http/Requests/Web/Auth/LoginRequest.php +++ b/app/Http/Requests/Web/Auth/LoginRequest.php @@ -44,9 +44,11 @@ public function authenticate(): void if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) { RateLimiter::hit($this->throttleKey()); - throw ValidationException::withMessages([ + throw ValidationException::withMessages( + [ 'email' => trans('auth.failed'), - ]); + ] + ); } RateLimiter::clear($this->throttleKey()); @@ -67,12 +69,16 @@ public function ensureIsNotRateLimited(): void $seconds = RateLimiter::availableIn($this->throttleKey()); - throw ValidationException::withMessages([ - 'email' => trans('auth.throttle', [ + throw ValidationException::withMessages( + [ + 'email' => trans( + 'auth.throttle', [ 'seconds' => $seconds, 'minutes' => ceil($seconds / 60), - ]), - ]); + ] + ), + ] + ); } /** diff --git a/app/Http/Requests/Web/Transaction/Budget/PatchRequest.php b/app/Http/Requests/Web/Transaction/Budget/PatchRequest.php index 13e94a3..70a2bf9 100644 --- a/app/Http/Requests/Web/Transaction/Budget/PatchRequest.php +++ b/app/Http/Requests/Web/Transaction/Budget/PatchRequest.php @@ -17,11 +17,13 @@ public function rules(): array 'name' => 'string', 'amount' => 'numeric|gte:0', 'type' => [ - Rule::in([ + Rule::in( + [ Budget::TYPE_MONTH, Budget::TYPE_WEEK, Budget::TYPE_DAY - ]) + ] + ) ] ]; } diff --git a/app/Http/Traits/HasJsonFailedValidationResponse.php b/app/Http/Traits/HasJsonFailedValidationResponse.php index 83bd84e..cc03eaf 100644 --- a/app/Http/Traits/HasJsonFailedValidationResponse.php +++ b/app/Http/Traits/HasJsonFailedValidationResponse.php @@ -17,10 +17,12 @@ protected function failedValidation(Validator $validator) $errors = (new ValidationException($validator))->errors(); throw new HttpResponseException( - response()->json([ + response()->json( + [ 'errors' => $errors, 'message' => 'validation.failed' - ], Response::HTTP_UNPROCESSABLE_ENTITY) + ], Response::HTTP_UNPROCESSABLE_ENTITY + ) ); } } diff --git a/app/Imports/TransactionsImport.php b/app/Imports/TransactionsImport.php index d9f4093..c1fb4ba 100644 --- a/app/Imports/TransactionsImport.php +++ b/app/Imports/TransactionsImport.php @@ -20,12 +20,11 @@ public function __construct( private readonly ColumnsMapping $columnsMapping, private readonly Import $import, private readonly User $user - ) - { + ) { } /** - * @param Collection $collection + * @param Collection $collection * @throws Throwable */ public function collection(Collection $collection): void @@ -34,7 +33,9 @@ public function collection(Collection $collection): void try { foreach ($collection as $row) { - /** @var TransactionImportService $service */ + /** + * @var TransactionImportService $service +*/ $service = app(TransactionImportService::class); $service->importFileRowAsTransaction($row, $this->import, $this->columnsMapping, $this->user); diff --git a/app/Jobs/Auth/CreateUserSettings.php b/app/Jobs/Auth/CreateUserSettings.php index 7567d7a..27753c6 100644 --- a/app/Jobs/Auth/CreateUserSettings.php +++ b/app/Jobs/Auth/CreateUserSettings.php @@ -14,7 +14,9 @@ class CreateUserSettings implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(public User $user) {} + public function __construct(public User $user) + { + } public function handle(UserSettingsService $userSettingsService): void { diff --git a/app/Jobs/Transaction/CategorizeTransactions.php b/app/Jobs/Transaction/CategorizeTransactions.php index 29f81e6..95426c4 100644 --- a/app/Jobs/Transaction/CategorizeTransactions.php +++ b/app/Jobs/Transaction/CategorizeTransactions.php @@ -22,7 +22,8 @@ public function __construct(public array $transactionsIds) /** * Execute the job. - * @throws Exception + * + * @throws Exception * @noinspection PhpUndefinedMethodInspection */ public function handle(TransactionCategorizeService $transactionCategorizeService): void diff --git a/app/Jobs/Transaction/RecategorizeAllTransactions.php b/app/Jobs/Transaction/RecategorizeAllTransactions.php index 57eef93..c3e2216 100644 --- a/app/Jobs/Transaction/RecategorizeAllTransactions.php +++ b/app/Jobs/Transaction/RecategorizeAllTransactions.php @@ -14,7 +14,9 @@ class RecategorizeAllTransactions implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, Batchable; - public function __construct() {} + public function __construct() + { + } public function handle(): void { diff --git a/app/Jobs/Transaction/ResolveTransactionCalculationVolume.php b/app/Jobs/Transaction/ResolveTransactionCalculationVolume.php index dea4df1..451b1d1 100644 --- a/app/Jobs/Transaction/ResolveTransactionCalculationVolume.php +++ b/app/Jobs/Transaction/ResolveTransactionCalculationVolume.php @@ -20,7 +20,9 @@ class ResolveTransactionCalculationVolume implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(public mixed $transactionId) {} + public function __construct(public mixed $transactionId) + { + } /** * @throws GuzzleException @@ -44,9 +46,11 @@ public function handle(CurrencyService $currencyService, ExchangeRatesService $e $oldCalculationVolume = $transaction->calculation_volume; - $transaction->update([ + $transaction->update( + [ 'calculation_volume' => $oldCalculationVolume * (float) $exchangeRate->rate - ]); + ] + ); } catch (Throwable $throwable) { Log::error($throwable); diff --git a/app/Jobs/Transaction/SaveTransactionCategoryReference.php b/app/Jobs/Transaction/SaveTransactionCategoryReference.php index d3e15fc..5bb3e62 100644 --- a/app/Jobs/Transaction/SaveTransactionCategoryReference.php +++ b/app/Jobs/Transaction/SaveTransactionCategoryReference.php @@ -14,7 +14,9 @@ class SaveTransactionCategoryReference implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(public mixed $transactionId) {} + public function __construct(public mixed $transactionId) + { + } public function handle(CategoryReferenceService $categoryReferenceService): void { diff --git a/app/Jobs/Transaction/UpdateUsersPersonalAccountSaldo.php b/app/Jobs/Transaction/UpdateUsersPersonalAccountSaldo.php index fa5b874..b41bb8c 100644 --- a/app/Jobs/Transaction/UpdateUsersPersonalAccountSaldo.php +++ b/app/Jobs/Transaction/UpdateUsersPersonalAccountSaldo.php @@ -14,7 +14,9 @@ class UpdateUsersPersonalAccountSaldo implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(public mixed $transactionId) {} + public function __construct(public mixed $transactionId) + { + } public function handle(SaldoService $saldoService): void { $transaction = Transaction::findOrFail($this->transactionId); diff --git a/app/Listeners/Auth/HandleWhenDeviceHijacked.php b/app/Listeners/Auth/HandleWhenDeviceHijacked.php index 6770e4b..66314c1 100644 --- a/app/Listeners/Auth/HandleWhenDeviceHijacked.php +++ b/app/Listeners/Auth/HandleWhenDeviceHijacked.php @@ -7,11 +7,15 @@ readonly class HandleWhenDeviceHijacked { - public function __construct(private DeviceService $deviceService) {} + public function __construct(private DeviceService $deviceService) + { + } public function handle(object $event): void { - /** @var DeviceHijacked $event */ + /** + * @var DeviceHijacked $event +*/ $this->deviceService->handleWhenDeviceHijacked($event); } } diff --git a/app/Mixins/AssertableJsonMixin.php b/app/Mixins/AssertableJsonMixin.php index 9570593..d9cc844 100644 --- a/app/Mixins/AssertableJsonMixin.php +++ b/app/Mixins/AssertableJsonMixin.php @@ -10,7 +10,9 @@ class AssertableJsonMixin public function hasValidPagination(): Closure { return function (): AssertableJson { - /** @var AssertableJson $this */ + /** + * @var AssertableJson $this +*/ return $this ->whereType('data', 'array') ->whereType('current_page', 'integer') diff --git a/app/Mixins/FactoryMixin.php b/app/Mixins/FactoryMixin.php index c58e4d9..0d509ba 100644 --- a/app/Mixins/FactoryMixin.php +++ b/app/Mixins/FactoryMixin.php @@ -11,11 +11,15 @@ */ class FactoryMixin { - /** @noinspection PhpUndefinedMethodInspection */ + /** + * @noinspection PhpUndefinedMethodInspection + */ public function firstOrCreate(): Closure { return function (): Model { - /** @var Factory $this */ + /** + * @var Factory $this +*/ return $this->modelName()::first() ?? $this->modelName()::factory()->create(); }; } diff --git a/app/Mixins/RouteMixin.php b/app/Mixins/RouteMixin.php index fe55ade..ed5741a 100644 --- a/app/Mixins/RouteMixin.php +++ b/app/Mixins/RouteMixin.php @@ -17,12 +17,19 @@ public function crud(): Closure ?string $update = null, ?string $delete = null ) { - /** @var Route $this */ - if ($index) $this->get('/', [$index, 'index']); - if ($show) $this->get('/{id}', [$show, 'show']); - if ($create) $this->post('/', [$create, 'create']); - if ($update) $this->put('/{id}', [$update, 'update']); - if ($delete) $this->delete('/{id}', [$delete, 'delete']); + /** + * @var Route $this +*/ + if ($index) { $this->get('/', [$index, 'index']); + } + if ($show) { $this->get('/{id}', [$show, 'show']); + } + if ($create) { $this->post('/', [$create, 'create']); + } + if ($update) { $this->put('/{id}', [$update, 'update']); + } + if ($delete) { $this->delete('/{id}', [$delete, 'delete']); + } return $this; }; diff --git a/app/Models/Auth/Settings.php b/app/Models/Auth/Settings.php index 755081e..dae01db 100644 --- a/app/Models/Auth/Settings.php +++ b/app/Models/Auth/Settings.php @@ -9,7 +9,7 @@ /** * @property string $base_currency_code * @property mixed $user_id - * @method static whereUser($user) + * @method static whereUser($user) */ class Settings extends Model { diff --git a/app/Models/ExchangeRates/ExchangeRate.php b/app/Models/ExchangeRates/ExchangeRate.php index 1fd0b8b..d0ca759 100644 --- a/app/Models/ExchangeRates/ExchangeRate.php +++ b/app/Models/ExchangeRates/ExchangeRate.php @@ -6,10 +6,10 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; /** - * @method static where(string[] $criteria) - * @method static whereDate(string $string, string $format) - * @method static create(array $array) - * @method static latest() + * @method static where(string[] $criteria) + * @method static whereDate(string $string, string $format) + * @method static create(array $array) + * @method static latest() * @property string $rate */ class ExchangeRate extends Model diff --git a/app/Models/File.php b/app/Models/File.php index 4e772d4..c8e0511 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -13,9 +13,9 @@ * @property int $import_setting_id * @property int $id * @property mixed $user_id - * @method static findOrFail(int $fileId) - * @method static latest() - * @method static whereUser(User $user) + * @method static findOrFail(int $fileId) + * @method static latest() + * @method static whereUser(User $user) */ class File extends Model { diff --git a/app/Models/Import/ColumnsMapping.php b/app/Models/Import/ColumnsMapping.php index e25141b..0f3ac77 100644 --- a/app/Models/Import/ColumnsMapping.php +++ b/app/Models/Import/ColumnsMapping.php @@ -19,10 +19,10 @@ * @property int|null $volume_column_index * @property int|null $sender_account_number_column_index * @property int|null $receiver_account_number_column_index - * @method static findOrFail(int $columnsMappingId) - * @method static latest() - * @method static create(array $data) - * @method static whereUser(User $user) + * @method static findOrFail(int $columnsMappingId) + * @method static latest() + * @method static create(array $data) + * @method static whereUser(User $user) */ class ColumnsMapping extends Model { diff --git a/app/Models/Import/Import.php b/app/Models/Import/Import.php index 85ca939..0c6a498 100644 --- a/app/Models/Import/Import.php +++ b/app/Models/Import/Import.php @@ -18,8 +18,8 @@ * @property int|null $file_id * @property int|null $synchronization_id * @property int $transactions_skipped_count - * @method static create(array $data) - * @method static whereUser(\App\Models\User $user) + * @method static create(array $data) + * @method static whereUser(\App\Models\User $user) */ class Import extends Model { diff --git a/app/Models/Import/ImportSetting.php b/app/Models/Import/ImportSetting.php index fe02801..7c58e9d 100644 --- a/app/Models/Import/ImportSetting.php +++ b/app/Models/Import/ImportSetting.php @@ -15,10 +15,10 @@ * @property int|null $start_row * @property int $id * @property mixed $user_id - * @method static findOrFail(int $importSettingId) - * @method static latest() - * @method static create(array $validatedData) - * @method static whereUser(User $user) + * @method static findOrFail(int $importSettingId) + * @method static latest() + * @method static create(array $validatedData) + * @method static whereUser(User $user) */ class ImportSetting extends Model { diff --git a/app/Models/Nordigen/EndUserAgreement.php b/app/Models/Nordigen/EndUserAgreement.php index bbdb265..41803fd 100644 --- a/app/Models/Nordigen/EndUserAgreement.php +++ b/app/Models/Nordigen/EndUserAgreement.php @@ -11,13 +11,13 @@ /** * @property string|null $nordigen_institution_id - * @var bool $is_successful - * @var Collection $requisitions - * @method static create(array $array) - * @method static firstWhere(string|array $attribute, mixed $value = null) - * @method static findOrFail(mixed $endUserAgreementId) - * @method static latest() - * @method static whereUser(User $user) + * @var bool $is_successful + * @var Collection $requisitions + * @method static create(array $array) + * @method static firstWhere(string|array $attribute, mixed $value = null) + * @method static findOrFail(mixed $endUserAgreementId) + * @method static latest() + * @method static whereUser(User $user) */ class EndUserAgreement extends Model { diff --git a/app/Models/Nordigen/Requisition.php b/app/Models/Nordigen/Requisition.php index 5c262b0..e5613a8 100644 --- a/app/Models/Nordigen/Requisition.php +++ b/app/Models/Nordigen/Requisition.php @@ -7,9 +7,9 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; /** - * @method static create(array $array) - * @method static latest() - * @method static whereUser($user) + * @method static create(array $array) + * @method static latest() + * @method static whereUser($user) * @property mixed $nordigen_requisition_id */ class Requisition extends Model diff --git a/app/Models/Notification.php b/app/Models/Notification.php index 9787822..5e6fb22 100644 --- a/app/Models/Notification.php +++ b/app/Models/Notification.php @@ -9,8 +9,8 @@ /** * @property string $content * @property int $id - * @method static whereUser(User $user) - * @method static create(array $array) + * @method static whereUser(User $user) + * @method static create(array $array) */ class Notification extends Model { diff --git a/app/Models/Synchronization/Account.php b/app/Models/Synchronization/Account.php index 740855b..49a0a93 100644 --- a/app/Models/Synchronization/Account.php +++ b/app/Models/Synchronization/Account.php @@ -8,10 +8,10 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; /** - * @method static create(array $array) - * @method static firstOrCreate(array $attributes, array $data) - * @method static latest() - * @method static whereUser(User $user) + * @method static create(array $array) + * @method static firstOrCreate(array $attributes, array $data) + * @method static latest() + * @method static whereUser(User $user) * @property int $id * @property string $nordigen_account_id */ diff --git a/app/Models/Synchronization/Synchronization.php b/app/Models/Synchronization/Synchronization.php index eea1d25..10afb93 100644 --- a/app/Models/Synchronization/Synchronization.php +++ b/app/Models/Synchronization/Synchronization.php @@ -11,9 +11,9 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; /** - * @var Carbon $created_at - * @method static create(array $data) - * @method static whereUser(User $user) + * @var Carbon $created_at + * @method static create(array $data) + * @method static whereUser(User $user) * @property mixed $id * @property int $code * @property int $status diff --git a/app/Models/Transaction/Category.php b/app/Models/Transaction/Category.php index d56a595..039ac4a 100644 --- a/app/Models/Transaction/Category.php +++ b/app/Models/Transaction/Category.php @@ -10,7 +10,7 @@ /** * @property string $code - * @method static firstOrCreate(string[] $categoryData) + * @method static firstOrCreate(string[] $categoryData) */ class Category extends Model { diff --git a/app/Models/Transaction/Persona.php b/app/Models/Transaction/Persona.php index 7247104..5ac25e3 100644 --- a/app/Models/Transaction/Persona.php +++ b/app/Models/Transaction/Persona.php @@ -7,9 +7,9 @@ use Illuminate\Database\Eloquent\Relations\HasMany; /** - * @method static create(array $array) - * @method static orderBy(string $string) - * @method static withCount(string $string, string $string1) + * @method static create(array $array) + * @method static orderBy(string $string) + * @method static withCount(string $string, string $string1) * @property string $associated_names * @property int $id * @property string $common_name diff --git a/app/Models/Transaction/PersonalAccount.php b/app/Models/Transaction/PersonalAccount.php index d0c557f..68bb9d4 100644 --- a/app/Models/Transaction/PersonalAccount.php +++ b/app/Models/Transaction/PersonalAccount.php @@ -9,7 +9,7 @@ /** * @property mixed $value - * @method static whereUser(mixed $user) + * @method static whereUser(mixed $user) */ class PersonalAccount extends Model { diff --git a/app/Models/Transaction/Transaction.php b/app/Models/Transaction/Transaction.php index 0f74484..28b2205 100644 --- a/app/Models/Transaction/Transaction.php +++ b/app/Models/Transaction/Transaction.php @@ -16,17 +16,17 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; /** - * @method static applyFilter(Filter $filter) - * @method static create(array $data) - * @method static firstWhere(array $attributes) - * @method static findOrFail(int $id) - * @method static cursor() - * @method static count() - * @method static whereExpenditure() - * @method static whereMonthAndYear(Carbon $now) - * @method static orderByTransactionDate() - * @method static whereUser(User $user) - * @method static chunk(int $chunkSize, \Closure $param) + * @method static applyFilter(Filter $filter) + * @method static create(array $data) + * @method static firstWhere(array $attributes) + * @method static findOrFail(int $id) + * @method static cursor() + * @method static count() + * @method static whereExpenditure() + * @method static whereMonthAndYear(Carbon $now) + * @method static orderByTransactionDate() + * @method static whereUser(User $user) + * @method static chunk(int $chunkSize, \Closure $param) * @property string $sender Sender name. * @property string $receiver Receiver name. * @property int $id Transaction primary key. @@ -102,7 +102,8 @@ public function synchronization(): BelongsTo public static function getFilterableColumns(): Collection { - return collect([ + return collect( + [ 'transaction_date' => [ 'operators' => ['lte', 'eq', 'gte', 'lt', 'gt'], 'input' => 'date', @@ -131,7 +132,8 @@ public static function getFilterableColumns(): Collection 'operators' => ['eq'], 'input' => 'text', ], - ]); + ] + ); } public function senderPersona(): BelongsTo diff --git a/app/Models/User.php b/app/Models/User.php index 453575c..09f891f 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -25,9 +25,9 @@ * @property Settings|null $settings * @property Collection $personalAccounts * @property Collection $budgets - * @method static cursor() - * @method static firstWhere(array $array) - * @method static findOrFail(mixed $userId) + * @method static cursor() + * @method static firstWhere(array $array) + * @method static findOrFail(mixed $userId) */ class User extends Authenticatable { diff --git a/app/Observers/Import/ImportObserver.php b/app/Observers/Import/ImportObserver.php index 31a5c91..74995ef 100644 --- a/app/Observers/Import/ImportObserver.php +++ b/app/Observers/Import/ImportObserver.php @@ -8,10 +8,12 @@ readonly class ImportObserver { - public function __construct(private CategorizeTransactionService $categorizeTransactionService) {} + public function __construct(private CategorizeTransactionService $categorizeTransactionService) + { + } /** - * @throws Throwable + * @throws Throwable * @noinspection PhpMissingReturnTypeInspection */ public function created(Import $import) diff --git a/app/Observers/Transaction/TransactionObserver.php b/app/Observers/Transaction/TransactionObserver.php index ade33b9..9a0041d 100644 --- a/app/Observers/Transaction/TransactionObserver.php +++ b/app/Observers/Transaction/TransactionObserver.php @@ -28,7 +28,7 @@ public function updating(Transaction $transaction): void { $this->cacheAdapter->clearUserCache($transaction->user); - if($transaction->isDirty('category_id')){ + if($transaction->isDirty('category_id')) { SaveTransactionCategoryReference::dispatch($transaction->id); } } diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index 2be04f5..6f55e51 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -14,6 +14,6 @@ public function boot(): void { Broadcast::routes(); - require base_path('routes/channels.php'); + include base_path('routes/channels.php'); } } diff --git a/app/Providers/HorizonServiceProvider.php b/app/Providers/HorizonServiceProvider.php index 76c42e5..e557270 100644 --- a/app/Providers/HorizonServiceProvider.php +++ b/app/Providers/HorizonServiceProvider.php @@ -29,10 +29,14 @@ public function boot(): void */ protected function gate(): void { - Gate::define('viewHorizon', function ($user) { - return in_array($user->email, [ - // - ]); - }); + Gate::define( + 'viewHorizon', function ($user) { + return in_array( + $user->email, [ + // + ] + ); + } + ); } } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 4df3bd9..90e8667 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -33,14 +33,16 @@ public function boot(): void { $this->configureRateLimiting(); - $this->routes(function () { - Route::middleware('api') - ->prefix('api') - ->group(base_path('routes/api.php')); + $this->routes( + function () { + Route::middleware('api') + ->prefix('api') + ->group(base_path('routes/api.php')); - Route::middleware('web') + Route::middleware('web') ->group(base_path('routes/web.php')); - }); + } + ); } /** @@ -48,8 +50,10 @@ public function boot(): void */ protected function configureRateLimiting(): void { - RateLimiter::for('api', function (Request $request) { - return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); - }); + RateLimiter::for( + 'api', function (Request $request) { + return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); + } + ); } } diff --git a/app/Providers/TelescopeServiceProvider.php b/app/Providers/TelescopeServiceProvider.php index 338d2c8..59f5def 100644 --- a/app/Providers/TelescopeServiceProvider.php +++ b/app/Providers/TelescopeServiceProvider.php @@ -18,17 +18,19 @@ public function register(): void $this->hideSensitiveRequestDetails(); - Telescope::filter(function (IncomingEntry $entry) { - if ($this->app->environment('local')) { - return true; - } + Telescope::filter( + function (IncomingEntry $entry) { + if ($this->app->environment('local')) { + return true; + } - return $entry->isReportableException() || + return $entry->isReportableException() || $entry->isFailedRequest() || $entry->isFailedJob() || $entry->isScheduledTask() || $entry->hasMonitoredTag(); - }); + } + ); } /** @@ -42,11 +44,13 @@ protected function hideSensitiveRequestDetails(): void Telescope::hideRequestParameters(['_token']); - Telescope::hideRequestHeaders([ + Telescope::hideRequestHeaders( + [ 'cookie', 'x-csrf-token', 'x-xsrf-token', - ]); + ] + ); } /** @@ -56,10 +60,14 @@ protected function hideSensitiveRequestDetails(): void */ protected function gate(): void { - Gate::define('viewTelescope', function ($user) { - return in_array($user->email, [ - 'text@example.com' - ]); - }); + Gate::define( + 'viewTelescope', function ($user) { + return in_array( + $user->email, [ + 'text@example.com' + ] + ); + } + ); } } diff --git a/app/Services/Analytics/AnalyticsService.php b/app/Services/Analytics/AnalyticsService.php index d64beca..9ded43a 100644 --- a/app/Services/Analytics/AnalyticsService.php +++ b/app/Services/Analytics/AnalyticsService.php @@ -20,7 +20,9 @@ public function getChartData(User $user, string $chartQueryId): array 'expendituresAndIncomesTrend' => ExpendituresAndIncomesTrend::class }; - /** @var ChartQuery $chartQuery */ + /** + * @var ChartQuery $chartQuery +*/ $chartQuery = app($chartQueryClass); return $chartQuery->get($user); } diff --git a/app/Services/Analytics/ChartQueries/CategoriesPercentage.php b/app/Services/Analytics/ChartQueries/CategoriesPercentage.php index 8149f11..d2698a4 100644 --- a/app/Services/Analytics/ChartQueries/CategoriesPercentage.php +++ b/app/Services/Analytics/ChartQueries/CategoriesPercentage.php @@ -12,12 +12,14 @@ class CategoriesPercentage extends ChartQuery public function get(User $user): array { $categories = Category::query() - ->withCount([ + ->withCount( + [ 'transactions as transactions_count' => function ($query) use ($user) { $query ->baseCalculationQuery() ->where('user_id', $user->id); - }]) + }] + ) ->get(); $totalTransactionsCategorized = $categories->sum('transactions_count'); @@ -26,10 +28,12 @@ public function get(User $user): array $categoriesValues = []; $categories - ->each(function ($category) use ($totalTransactionsCategorized, &$categoriesLabels, &$categoriesValues) { - $categoriesLabels[] = Str::ucfirst($category->code); - $categoriesValues[] = $totalTransactionsCategorized ? $category->transactions_count / $totalTransactionsCategorized : 0; - }); + ->each( + function ($category) use ($totalTransactionsCategorized, &$categoriesLabels, &$categoriesValues) { + $categoriesLabels[] = Str::ucfirst($category->code); + $categoriesValues[] = $totalTransactionsCategorized ? $category->transactions_count / $totalTransactionsCategorized : 0; + } + ); return DoughnutChart::make( header: ' Of category', diff --git a/app/Services/Analytics/ChartQueries/CategorizedPercentage.php b/app/Services/Analytics/ChartQueries/CategorizedPercentage.php index 7ea2846..7794cfb 100644 --- a/app/Services/Analytics/ChartQueries/CategorizedPercentage.php +++ b/app/Services/Analytics/ChartQueries/CategorizedPercentage.php @@ -12,12 +12,14 @@ class CategorizedPercentage extends ChartQuery public function get(User $user): array { $categories = Category::query() - ->withCount([ + ->withCount( + [ 'transactions as transactions_count' => function ($query) use ($user) { $query ->baseCalculationQuery() ->where('user_id', $user->id); - }]) + }] + ) ->get(); $totalTransactions = Transaction::whereUser($user)->baseCalculationQuery()->count(); diff --git a/app/Services/Analytics/Charts/Traits/UseGenerateSimilarColors.php b/app/Services/Analytics/Charts/Traits/UseGenerateSimilarColors.php index 18f052d..4f5efd6 100644 --- a/app/Services/Analytics/Charts/Traits/UseGenerateSimilarColors.php +++ b/app/Services/Analytics/Charts/Traits/UseGenerateSimilarColors.php @@ -22,11 +22,13 @@ protected static function generateColors(int $count): array protected static function generateRandomColor(): string { - $randomizedRgb = array_map(function ($value) { - $randomValue = mt_rand(-100, 100); - $newValue = $value + $randomValue; - return max(0, min(255, $newValue)); - }, self::getBaseRGBValues()); + $randomizedRgb = array_map( + function ($value) { + $randomValue = mt_rand(-100, 100); + $newValue = $value + $randomValue; + return max(0, min(255, $newValue)); + }, self::getBaseRGBValues() + ); return sprintf("#%02x%02x%02x", ...$randomizedRgb); } diff --git a/app/Services/Auth/Api/UserService.php b/app/Services/Auth/Api/UserService.php index ee41348..4181139 100644 --- a/app/Services/Auth/Api/UserService.php +++ b/app/Services/Auth/Api/UserService.php @@ -44,7 +44,9 @@ public function login(array $data): array ]; } - /** @noinspection PhpPossiblePolymorphicInvocationInspection */ + /** + * @noinspection PhpPossiblePolymorphicInvocationInspection + */ public function logout(Authenticatable $user): void { $user->tokens()->delete(); diff --git a/app/Services/Auth/Device/DeviceService.php b/app/Services/Auth/Device/DeviceService.php index 36da37a..b55c0f4 100644 --- a/app/Services/Auth/Device/DeviceService.php +++ b/app/Services/Auth/Device/DeviceService.php @@ -10,7 +10,9 @@ readonly class DeviceService { - public function __construct(private NotificationBroadcastService $notificationBroadcastService) {} + public function __construct(private NotificationBroadcastService $notificationBroadcastService) + { + } public function all(User $user): Collection { diff --git a/app/Services/Auth/Registration/OneTimeToken/TokenRegistrationService.php b/app/Services/Auth/Registration/OneTimeToken/TokenRegistrationService.php index 7de5ebc..96312ae 100644 --- a/app/Services/Auth/Registration/OneTimeToken/TokenRegistrationService.php +++ b/app/Services/Auth/Registration/OneTimeToken/TokenRegistrationService.php @@ -7,7 +7,9 @@ readonly class TokenRegistrationService { - public function __construct(private CacheAdapterInterface $cacheAdapter) {} + public function __construct(private CacheAdapterInterface $cacheAdapter) + { + } private const ONE_TIME_REGISTRATION_TOKEN_CACHE_KEY = 'auth_one_time_registration_token'; diff --git a/app/Services/ExchangeRates/DataObjects/HistoricalExchangeRateDataObject.php b/app/Services/ExchangeRates/DataObjects/HistoricalExchangeRateDataObject.php index 55894d5..4d6957b 100644 --- a/app/Services/ExchangeRates/DataObjects/HistoricalExchangeRateDataObject.php +++ b/app/Services/ExchangeRates/DataObjects/HistoricalExchangeRateDataObject.php @@ -12,7 +12,8 @@ public function __construct( public string $rate, public string $baseCurrencyCode, public string $targetCurrencyCode, - ) {} + ) { + } public static function make(mixed $data): self { diff --git a/app/Services/ExchangeRates/ExchangeRatesService.php b/app/Services/ExchangeRates/ExchangeRatesService.php index 90c3c69..625f693 100644 --- a/app/Services/ExchangeRates/ExchangeRatesService.php +++ b/app/Services/ExchangeRates/ExchangeRatesService.php @@ -16,7 +16,9 @@ class ExchangeRatesService implements ExchangeRatesServiceInterface { use DecodesHttpJsonResponse; - public function __construct(private readonly ExchangeRatesClient $exchangeRatesClient) { } + public function __construct(private readonly ExchangeRatesClient $exchangeRatesClient) + { + } public function all(): Collection { @@ -38,12 +40,14 @@ public function getOrCreateExchangeRate(Carbon $date, string $baseCurrencyCode, if (!$exchangeRate) { $dataObject = $this->provideNewHistoryRate($date, $baseCurrencyCode, $targetCurrencyCode); - return ExchangeRate::create([ + return ExchangeRate::create( + [ 'rate' => $dataObject->rate, 'base_currency' => $dataObject->baseCurrencyCode, 'target_currency' => $dataObject->targetCurrencyCode, 'rate_source_date' => $dataObject->date, - ]); + ] + ); } return $exchangeRate; @@ -57,12 +61,14 @@ public function provideNewHistoryRate(Carbon $date, string $baseCurrencyCode, st { $dateString = $date->format('Y-m-d'); - $response = $this->exchangeRatesClient->get("/exchangerates_data/$dateString", [ + $response = $this->exchangeRatesClient->get( + "/exchangerates_data/$dateString", [ 'query' => [ 'base' => $baseCurrencyCode, 'symbols' => $targetCurrencyCode, ], - ]); + ] + ); $responseData = $this->decodedResponse($response); diff --git a/app/Services/ExchangeRates/Provider/ExchangeRatesServiceProvider.php b/app/Services/ExchangeRates/Provider/ExchangeRatesServiceProvider.php index 2b57ebb..941dfcf 100644 --- a/app/Services/ExchangeRates/Provider/ExchangeRatesServiceProvider.php +++ b/app/Services/ExchangeRates/Provider/ExchangeRatesServiceProvider.php @@ -11,15 +11,19 @@ class ExchangeRatesServiceProvider extends ServiceProvider { public function register(): void { - $this->app->singleton(ExchangeRatesClient::class, function ($app) { - return new ExchangeRatesClient([ - 'base_uri' => $app->config->get('exchange_rates.base_uri'), - 'headers' => [ + $this->app->singleton( + ExchangeRatesClient::class, function ($app) { + return new ExchangeRatesClient( + [ + 'base_uri' => $app->config->get('exchange_rates.base_uri'), + 'headers' => [ 'apikey' => $app->config->get('exchange_rates.api_key'), 'Accept' => 'application/json', - ], - ]); - }); + ], + ] + ); + } + ); $this->app->bind(ExchangeRatesServiceInterface::class, ExchangeRatesService::class); } diff --git a/app/Services/File/FileUploadService.php b/app/Services/File/FileUploadService.php index 5cc825f..5d6cc78 100644 --- a/app/Services/File/FileUploadService.php +++ b/app/Services/File/FileUploadService.php @@ -12,8 +12,7 @@ public function __construct( private ProfileFileService $profileFileService, private TransactionFileService $transactionFileService - ) - { + ) { } /** @@ -38,9 +37,11 @@ public function upload(User $user, UploadedFile $file, array $data): void ); } catch(\Throwable) { - throw ValidationException::withMessages([ + throw ValidationException::withMessages( + [ 'file' => 'Invalid file, please check import configuration.' - ]); + ] + ); } } } diff --git a/app/Services/File/Traits/RegistersFileInDBAndStoresOnDisk.php b/app/Services/File/Traits/RegistersFileInDBAndStoresOnDisk.php index fd80c1a..95a98ac 100644 --- a/app/Services/File/Traits/RegistersFileInDBAndStoresOnDisk.php +++ b/app/Services/File/Traits/RegistersFileInDBAndStoresOnDisk.php @@ -10,9 +10,11 @@ trait RegistersFileInDBAndStoresOnDisk { protected function registerAndStoreFile(File $fileModel, UploadedFile $fileObj, string $fileName): void { - DB::transaction(function () use ($fileModel, $fileObj, $fileName) { - $fileModel->save(); - $fileObj->storeAs('uploads', $fileName); - }); + DB::transaction( + function () use ($fileModel, $fileObj, $fileName) { + $fileModel->save(); + $fileObj->storeAs('uploads', $fileName); + } + ); } } diff --git a/app/Services/File/TransactionFileService.php b/app/Services/File/TransactionFileService.php index cdae2e0..0f94dc3 100644 --- a/app/Services/File/TransactionFileService.php +++ b/app/Services/File/TransactionFileService.php @@ -12,7 +12,9 @@ class TransactionFileService { use RegistersFileInDBAndStoresOnDisk; - public function __construct(private readonly ImportService $importService) {} + public function __construct(private readonly ImportService $importService) + { + } public function uploadTransactions(mixed $requestFile, mixed $importSettingId, mixed $columnMappingId, User $user): void { diff --git a/app/Services/FileExplorer/DirectoryRenderBuilder.php b/app/Services/FileExplorer/DirectoryRenderBuilder.php index 0e34033..ac1638b 100644 --- a/app/Services/FileExplorer/DirectoryRenderBuilder.php +++ b/app/Services/FileExplorer/DirectoryRenderBuilder.php @@ -28,19 +28,23 @@ public function build(): self $directoryName = $this->getShortEntityName($path); $sourcePath = $this->targetPath . '/' . $directoryName; - $this->render .= view('file_explorer.partials.folder', [ + $this->render .= view( + 'file_explorer.partials.folder', [ 'url' => route('api.file_explorer.open', ['path' => $sourcePath]), 'directoryName' => $directoryName, - ])->render(); + ] + )->render(); } foreach (Storage::files($this->targetPath) as $path) { $fileName = $this->getShortEntityName($path); - $this->render .= view('file_explorer.partials.file', [ + $this->render .= view( + 'file_explorer.partials.file', [ 'file' => $fileName, 'filePath' => $this->targetPath . '/' . $fileName - ])->render(); + ] + )->render(); } if ($this->render === '') { diff --git a/app/Services/FileExplorer/FileRenderBuilder.php b/app/Services/FileExplorer/FileRenderBuilder.php index 8190ad5..546cd7d 100644 --- a/app/Services/FileExplorer/FileRenderBuilder.php +++ b/app/Services/FileExplorer/FileRenderBuilder.php @@ -74,9 +74,11 @@ public function getRenderedFile(): ?string protected function renderAsBinaryFile(): string { $this->fileType = self::FILE_TYPE_BINARY; - return view('file_explorer.partials.binary-file', [ + return view( + 'file_explorer.partials.binary-file', [ 'fileName' => $this->fileName - ])->render(); + ] + )->render(); } protected function renderAsVideoFile(): string @@ -84,28 +86,34 @@ protected function renderAsVideoFile(): string $this->fileType = self::FILE_TYPE_VIDEO; $extension = FileHelper::extractExtension($this->fileName); - return view('file_explorer.partials.video-file', [ + return view( + 'file_explorer.partials.video-file', [ 'fileName' => $this->fileName, 'fileExtension' => $extension, 'src' => route('api.file_explorer.get', ['path' => $this->storageFilePath]) - ])->render(); + ] + )->render(); } protected function renderAsTextFile(string $content): string { - return view('file_explorer.partials.text-file', [ + return view( + 'file_explorer.partials.text-file', [ 'fileName' => $this->fileName, 'content' => $content - ])->render(); + ] + )->render(); } protected function renderAsImageFile(): string { $this->fileType = self::FILE_TYPE_IMAGE; - return view('file_explorer.partials.image-file', [ + return view( + 'file_explorer.partials.image-file', [ 'fileName' => $this->fileName, 'src' => route('api.file_explorer.get', ['path' => $this->storageFilePath]) - ])->render(); + ] + )->render(); } public function getFileType(): ?string diff --git a/app/Services/Helpers/StringHelper.php b/app/Services/Helpers/StringHelper.php index 8cc48c4..7794a16 100644 --- a/app/Services/Helpers/StringHelper.php +++ b/app/Services/Helpers/StringHelper.php @@ -39,8 +39,8 @@ public static function findLongestCommonSubstringInArray(array $strings): string * in two given strings. The algorithm runs in linear time O(mn), * where m and n are the lengths of the input strings. * - * @param string $str1 - * @param string $str2 + * @param string $str1 + * @param string $str2 * @return string */ public static function findLongestCommonSubstring(string $str1, string $str2): string @@ -80,13 +80,14 @@ public static function findLongestCommonSubstring(string $str1, string $str2): s * WordPress' implementation of function which * removes accents of different languages from string. * - * @param $string + * @param $string * @return string */ public static function removeAccents($string): string { - if (!preg_match('/[\x80-\xff]/', $string)) + if (!preg_match('/[\x80-\xff]/', $string)) { return $string; + } $chars = array( // Decompositions for Latin-1 Supplement diff --git a/app/Services/Helpers/TimeHelper.php b/app/Services/Helpers/TimeHelper.php index 11fc809..2e4602a 100644 --- a/app/Services/Helpers/TimeHelper.php +++ b/app/Services/Helpers/TimeHelper.php @@ -6,15 +6,17 @@ class TimeHelper { /** * Returns rough (in largest single unit) time elapsed between two times. - * @param int $iTime0 Initial time, as time_t. - * @param int $iTime1 Final time, as time_t. 0=use current time. + * + * @param int $iTime0 Initial time, as time_t. + * @param int $iTime1 Final time, as time_t. 0=use current time. * @return string Time elapsed, like "5 minutes" or "3 days" or "1 month". * You might print "ago" after this return if $iTime1 is now. * @author Dan Kamins - dos at axonchisel dot net */ static function ax_getRoughTimeElapsedAsText(int $iTime0, int $iTime1 = 0): string { - if ($iTime1 == 0) { $iTime1 = time(); } + if ($iTime1 == 0) { $iTime1 = time(); + } $iTimeElapsed = $iTime1 - $iTime0; if ($iTimeElapsed < (60)) { diff --git a/app/Services/Home/HomePageService.php b/app/Services/Home/HomePageService.php index e92254b..8bfffb6 100644 --- a/app/Services/Home/HomePageService.php +++ b/app/Services/Home/HomePageService.php @@ -22,13 +22,13 @@ public function __construct( private readonly TransactionQuerySet $transactionQuerySet, private readonly SynchronizationService $synchronizationService, private readonly TransactionSyncServiceInterface $transactionSyncService, - ) - { + ) { } public function getHomeData(User $user): Collection { - return collect([ + return collect( + [ 'user' => $user, 'budgetsWithConsumption' => $this->budgetService->allWithConsumption($user), 'currencyCode' => $this->currencyService->resolveCalculationCurrency($user), @@ -45,6 +45,7 @@ public function getHomeData(User $user): Collection 'transactions' => $this->transactionQuerySet->getTenLatestTransactionsByUserForHomePage($user), 'last_synchronization' => $this->synchronizationService->getLatestSucceededByUser($user) ] - ]); + ] + ); } } diff --git a/app/Services/Home/HomePageServiceCachingDecorator.php b/app/Services/Home/HomePageServiceCachingDecorator.php index 365d3d7..1cd7887 100644 --- a/app/Services/Home/HomePageServiceCachingDecorator.php +++ b/app/Services/Home/HomePageServiceCachingDecorator.php @@ -11,8 +11,7 @@ public function __construct( private CacheAdapterInterface $cacheAdapter, private HomePageService $homePageService - ) - { + ) { } public function getHomeData(User $user): Collection diff --git a/app/Services/Import/ImportService.php b/app/Services/Import/ImportService.php index 40a1819..daf9011 100644 --- a/app/Services/Import/ImportService.php +++ b/app/Services/Import/ImportService.php @@ -34,19 +34,23 @@ public function importFromFile(int $fileId, int $importSettingId, int $columnsMa $columnsMapping = ColumnsMapping::findOrFail($columnsMappingId); $file = File::findOrFail($fileId); - $import = new Import([ + $import = new Import( + [ 'user_id' => $user->id, 'status' => Import::STATUS_PROCESSING, 'columns_mapping_id' => $columnsMappingId, 'import_setting_id' => $importSettingId, 'file_id' => $file->id, - ]); + ] + ); $import->save(); - DB::transaction(function () use ($file, $importSetting, $columnsMapping, $import, $user) { - Excel::import(new TransactionsImport($importSetting, $columnsMapping, $import, $user), $file->path); - }); + DB::transaction( + function () use ($file, $importSetting, $columnsMapping, $import, $user) { + Excel::import(new TransactionsImport($importSetting, $columnsMapping, $import, $user), $file->path); + } + ); $import->update(['status' => Import::STATUS_SAVED]); diff --git a/app/Services/Meta/MetaService.php b/app/Services/Meta/MetaService.php index b6ac4c7..909af5b 100644 --- a/app/Services/Meta/MetaService.php +++ b/app/Services/Meta/MetaService.php @@ -12,8 +12,7 @@ public function __construct( private ShellService $shellService, private CacheAdapterInterface $cacheAdapter - ) - { + ) { } public function getAppMetaData(): array @@ -55,7 +54,9 @@ public function getTopProcesses(): array return ['processes' => $this->getTopData()]; } - /** @noinspection SqlDialectInspection */ + /** + * @noinspection SqlDialectInspection + */ public function getTablesSizes(): array { return DB::table('information_schema.TABLES') @@ -99,13 +100,15 @@ public function getJobsList(): Collection $jobs = DB::table('jobs')->select()->latest()->get(); if ($jobs->count() === 0) { - $jobs = collect([ + $jobs = collect( + [ [ 'id' => 10, 'name' => 'CategorizeTransaction', 'queued_at' => '02-12-1999 13:12' ], - ]); + ] + ); } return $jobs; diff --git a/app/Services/Nordigen/DataObjects/TransactionDataObject.php b/app/Services/Nordigen/DataObjects/TransactionDataObject.php index 985da19..ff863ce 100644 --- a/app/Services/Nordigen/DataObjects/TransactionDataObject.php +++ b/app/Services/Nordigen/DataObjects/TransactionDataObject.php @@ -7,34 +7,43 @@ class TransactionDataObject extends DataObject { public function __construct( - /** @var string $rawVolume Operation raw volume */ + /** + * @var string $rawVolume Operation raw volume + */ public string $rawVolume, - - /** @var string $currency Operation currency code */ + /** + * @var string $currency Operation currency code + */ public string $currency, - - /** @var string $valueDate Operation execution date */ + /** + * @var string $valueDate Operation execution date + */ public string $valueDate, - - /** @var string|null $bookingDate Operation booking date */ + /** + * @var string|null $bookingDate Operation booking date + */ public ?string $bookingDate, - - /** @var string|null $debtorName Operation sender name */ + /** + * @var string|null $debtorName Operation sender name + */ public ?string $debtorName, - - /** @var string|null $creditorName Operation receiver name */ + /** + * @var string|null $creditorName Operation receiver name + */ public ?string $creditorName, - - /** @var string|null $remittanceInformationUnstructured Operation details/description */ + /** + * @var string|null $remittanceInformationUnstructured Operation details/description + */ public ?string $remittanceInformationUnstructured, - - /** @var string|null $senderAccountNumber Sender IBAN Number */ + /** + * @var string|null $senderAccountNumber Sender IBAN Number + */ public ?string $senderAccountNumber, - - /** @var string|null $receiverAccountNumber Receiver IBAN Number */ + /** + * @var string|null $receiverAccountNumber Receiver IBAN Number + */ public ?string $receiverAccountNumber, - ) - { + ) { } public static function make(mixed $data): self diff --git a/app/Services/Nordigen/NordigenService.php b/app/Services/Nordigen/NordigenService.php index c5c2ce1..e78dc83 100644 --- a/app/Services/Nordigen/NordigenService.php +++ b/app/Services/Nordigen/NordigenService.php @@ -1,4 +1,6 @@ -nordigenAccountService->all($user); foreach ($accounts as $account) { - $import = Import::create([ + $import = Import::create( + [ 'user_id' => $user->id, 'synchronization_id' => $synchronizationId, 'status' => Import::STATUS_IMPORTING - ]); + ] + ); try { $this->syncTransactionsByAccount($account, $import, $user); @@ -86,9 +89,11 @@ protected function syncTransactionsByAccount(Account $account, Import $import, U { $uri = self::ACCOUNTS_URI . $account->nordigen_account_id . '/transactions/'; - $response = $this->httpClient->get($uri, [ + $response = $this->httpClient->get( + $uri, [ 'headers' => $this->getAuthorizationHeader(), - ]); + ] + ); $transactionsData = $this->decodedResponse($response); @@ -125,9 +130,11 @@ public function syncAccounts(mixed $requisitionId, mixed $synchronizationId, Use { $uri = self::NEW_REQUISITION_URI . $requisitionId . '/'; - $response = $this->httpClient->get($uri, [ + $response = $this->httpClient->get( + $uri, [ 'headers' => $this->getAuthorizationHeader(), - ]); + ] + ); $accountsData = $this->decodedResponse($response); $accountsIds = data_get($accountsData, 'accounts'); @@ -135,14 +142,16 @@ public function syncAccounts(mixed $requisitionId, mixed $synchronizationId, Use if (is_array($accountsIds)) { foreach ($accountsIds as $accountId) { // @todo add deleting non existing accounts - Account::firstOrCreate([ + Account::firstOrCreate( + [ 'user_id' => $user->id, 'nordigen_account_id' => $accountId, - ], [ + ], [ 'user_id' => $user->id, 'nordigen_account_id' => $accountId, 'synchronization_id' => $synchronizationId, - ]); + ] + ); } } } @@ -178,16 +187,19 @@ public function createNewRequisition(mixed $institutionId, mixed $endUserAgreeme ]; try { - $response = $this->httpClient->post(self::NEW_REQUISITION_URI, [ + $response = $this->httpClient->post( + self::NEW_REQUISITION_URI, [ 'json' => $requestBody, 'headers' => $this->getAuthorizationHeader(), - ]); + ] + ); $requisitionData = $this->decodedResponse($response); $isSuccessful = data_get($requisitionData, 'status') === self::REQUISITION_CREATED_STATUS; if ($isSuccessful) { - return Requisition::create([ + return Requisition::create( + [ 'user_id' => $user->id, 'reference' => data_get($requisitionData, 'reference'), 'link' => data_get($requisitionData, 'link'), @@ -196,7 +208,8 @@ public function createNewRequisition(mixed $institutionId, mixed $endUserAgreeme 'raw_request_body' => json_encode($requestBody), 'end_user_agreement_id' => $endUserAgreement->id, 'nordigen_institution_id' => $institutionId, - ]); + ] + ); } return [ @@ -217,10 +230,12 @@ public function createNewRequisition(mixed $institutionId, mixed $endUserAgreeme public function getExistingAgreementForInstitution(User $user, mixed $institutionId): ?EndUserAgreement { - return EndUserAgreement::firstWhere([ + return EndUserAgreement::firstWhere( + [ 'user_id' => $user->id, 'nordigen_institution_id' => $institutionId - ]); + ] + ); } public function getAgreementById(User $user, mixed $id): ?EndUserAgreement @@ -243,16 +258,19 @@ public function createNewUserAgreement(User $user, mixed $institutionId): EndUse ]; try { - $response = $this->httpClient->post(self::NEW_END_USER_AGREEMENTS_URI, [ + $response = $this->httpClient->post( + self::NEW_END_USER_AGREEMENTS_URI, [ 'json' => $requestBody, 'headers' => $this->getAuthorizationHeader(), - ]); + ] + ); $userAgreementData = $this->decodedResponse($response); $isSuccessful = $response->getStatusCode() > 100 && $response->getStatusCode() < 300; $nordigenCreated = data_get($userAgreementData, 'created'); - return EndUserAgreement::create([ + return EndUserAgreement::create( + [ 'user_id' => $user->id, 'is_successful' => $isSuccessful, 'raw_request_body' => json_encode($requestBody), @@ -260,7 +278,8 @@ public function createNewUserAgreement(User $user, mixed $institutionId): EndUse 'nordigen_institution_id' => data_get($userAgreementData, 'institution_id'), 'nordigen_end_user_agreement_id' => data_get($userAgreementData, 'id'), 'nordigen_end_user_agreement_created' => Carbon::parse($nordigenCreated), - ]); + ] + ); } catch (Throwable $throwable) { return [ @@ -271,9 +290,9 @@ public function createNewUserAgreement(User $user, mixed $institutionId): EndUse } /** - * @return array|InstitutionDataObject[] + * @return array|InstitutionDataObject[] * @noinspection PhpMissingReturnTypeInspection - * @throws GuzzleException + * @throws GuzzleException */ public function provideSupportedInstitutionsData() { @@ -291,7 +310,7 @@ public function provideSupportedInstitutionsData() } /** - * @return array|InstitutionDataObject[] + * @return array|InstitutionDataObject[] * @noinspection PhpMissingReturnTypeInspection */ public function getInstitutionsDataObjects(array $institutionsData): array @@ -314,10 +333,12 @@ public function getFreshSupportedInstitutionsData(): array 'country' => config('nordigen.country'), ]; - $response = $this->httpClient->get(self::INSTITUTIONS_URI, [ + $response = $this->httpClient->get( + self::INSTITUTIONS_URI, [ 'query' => $requestQuery, 'headers' => $this->getAuthorizationHeader(), - ]); + ] + ); return $this->decodedResponse($response); } @@ -351,9 +372,11 @@ public function getFreshTokenData(): array 'secret_key' => config('nordigen.secret_key'), ]; - $response = $this->httpClient->post(self::NEW_TOKEN_URI, [ + $response = $this->httpClient->post( + self::NEW_TOKEN_URI, [ 'json' => $requestBody, - ]); + ] + ); return $this->decodedResponse($response); } @@ -389,18 +412,22 @@ public function getInstitutionByExternalId(mixed $institutionId): ?InstitutionDa public function setStatusSucceeded(Synchronization $synchronization): void { - $synchronization->update([ + $synchronization->update( + [ 'status' => Synchronization::SYNC_STATUS_SUCCEEDED, 'code' => 200 - ]); + ] + ); } public function setStatusFailed(Synchronization $synchronization, ?int $status = null): void { - $synchronization->update([ + $synchronization->update( + [ 'status' => Synchronization::SYNC_STATUS_FAILED, 'code' => $status - ]); + ] + ); } protected function hasTokenRefreshExpired(?array $tokenData): bool diff --git a/app/Services/Nordigen/Provider/NordigenServiceProvider.php b/app/Services/Nordigen/Provider/NordigenServiceProvider.php index a89b69a..fbda800 100644 --- a/app/Services/Nordigen/Provider/NordigenServiceProvider.php +++ b/app/Services/Nordigen/Provider/NordigenServiceProvider.php @@ -11,12 +11,16 @@ class NordigenServiceProvider extends ServiceProvider { public function register(): void { - $this->app->singleton(NordigenClient::class, function ($app) { - return new NordigenClient([ - 'base_uri' => $app->config->get('nordigen.base_uri'), - 'headers' => $app->config->get('nordigen.headers'), - ]); - }); + $this->app->singleton( + NordigenClient::class, function ($app) { + return new NordigenClient( + [ + 'base_uri' => $app->config->get('nordigen.base_uri'), + 'headers' => $app->config->get('nordigen.headers'), + ] + ); + } + ); $this->app->bind(NordigenTransactionServiceInterface::class, TransactionSyncService::class); } diff --git a/app/Services/Notification/Broadcast/NotificationBroadcastService.php b/app/Services/Notification/Broadcast/NotificationBroadcastService.php index 0ee3a67..e6183e5 100644 --- a/app/Services/Notification/Broadcast/NotificationBroadcastService.php +++ b/app/Services/Notification/Broadcast/NotificationBroadcastService.php @@ -16,15 +16,19 @@ public function sendStoredApplicationNotification( mixed $userId = null, ?int $type = null ): void { - Notification::create([ + Notification::create( + [ 'user_id' => $userId, - 'content' => json_encode([ + 'content' => json_encode( + [ 'header' => $header, 'content' => $content, 'url' => $url, - ]), + ] + ), 'type' => $type ?? Notification::TYPE_INFO - ]); + ] + ); // @todo - broadcast only to specific users try { diff --git a/app/Services/Transaction/Budget/BudgetConsumtptionService.php b/app/Services/Transaction/Budget/BudgetConsumtptionService.php index cb11a02..d179e52 100644 --- a/app/Services/Transaction/Budget/BudgetConsumtptionService.php +++ b/app/Services/Transaction/Budget/BudgetConsumtptionService.php @@ -10,7 +10,9 @@ class BudgetConsumtptionService { - public function __construct(private readonly TransactionQuerySet $transactionQuerySet) {} + public function __construct(private readonly TransactionQuerySet $transactionQuerySet) + { + } public function getBudgetsConsumptionByUser(User $user): Collection { @@ -34,12 +36,14 @@ public function getBudgetsConsumptionByUser(User $user): Collection ->getExpendituresSumByDates($user, $weekDates); } - $budgetsConsumptionData->push([ + $budgetsConsumptionData->push( + [ 'budget' => $budget, 'budget_amount' => (float) $budget->amount, 'period_expenditures_sum' => (float) $periodExpendituresSum, 'consumption' => (float) abs($periodExpendituresSum / $budget->amount), - ]); + ] + ); } return $budgetsConsumptionData; diff --git a/app/Services/Transaction/Budget/BudgetService.php b/app/Services/Transaction/Budget/BudgetService.php index dc6a63a..4076c68 100644 --- a/app/Services/Transaction/Budget/BudgetService.php +++ b/app/Services/Transaction/Budget/BudgetService.php @@ -11,7 +11,8 @@ public function __construct( private DefaultBudgetService $defaultBudgetService, private BudgetConsumtptionService $budgetConsumptionService - ) {} + ) { + } public function allWithConsumption(User $user): Collection { @@ -34,10 +35,12 @@ public function update(Budget $budget, mixed $data): Budget public function findOrFail(int $id, mixed $user): Budget { - $budget = Budget::where([ + $budget = Budget::where( + [ 'id' => $id, 'user_id' => $user->id, - ]) + ] + ) ->get() ->first(); diff --git a/app/Services/Transaction/Categorize/CategorizationService.php b/app/Services/Transaction/Categorize/CategorizationService.php index 4ca5f34..881ecff 100644 --- a/app/Services/Transaction/Categorize/CategorizationService.php +++ b/app/Services/Transaction/Categorize/CategorizationService.php @@ -11,9 +11,12 @@ readonly class CategorizationService { public function __construct(private CacheAdapterInterface $cacheAdapter) - {} + { + } - /** @noinspection PhpUndefinedMethodInspection */ + /** + * @noinspection PhpUndefinedMethodInspection + */ public function getStats(): array { $categorizedPercentage = 0; diff --git a/app/Services/Transaction/Categorize/CategoryReferenceService.php b/app/Services/Transaction/Categorize/CategoryReferenceService.php index 84828dc..fc5924c 100644 --- a/app/Services/Transaction/Categorize/CategoryReferenceService.php +++ b/app/Services/Transaction/Categorize/CategoryReferenceService.php @@ -17,9 +17,11 @@ public function saveReference(Transaction $transaction): ?int $requestUrl = config('egghead.save_reference_uri'); try { - $response = Http::withHeaders([ + $response = Http::withHeaders( + [ 'x-api-key' => config('egghead.api_token') - ])->post( + ] + )->post( url: $requestUrl, data: [ 'data' => [ @@ -28,7 +30,7 @@ public function saveReference(Transaction $transaction): ?int 'category' => Category::findOrFail($transaction->category_id)->toArray() ], 'params' => [] - ] + ] ); } catch (Throwable $throwable) { diff --git a/app/Services/Transaction/Categorize/TransactionCategorizeService.php b/app/Services/Transaction/Categorize/TransactionCategorizeService.php index 5e42a93..af121ad 100644 --- a/app/Services/Transaction/Categorize/TransactionCategorizeService.php +++ b/app/Services/Transaction/Categorize/TransactionCategorizeService.php @@ -15,7 +15,9 @@ public function categorizeTransactions(Collection|LazyCollection|array $transact { $postData = []; foreach ($transactions as $transaction) { - /** @var Transaction $transaction */ + /** + * @var Transaction $transaction +*/ $postData[] = [ 'id' => $transaction->id, 'currency_id' => $transaction->currency, @@ -35,9 +37,11 @@ public function categorizeTransactions(Collection|LazyCollection|array $transact $requestUrl = config('egghead.base_api_url'); // @todo refactor - $response = Http::withHeaders([ + $response = Http::withHeaders( + [ 'x-api-key' => config('egghead.api_token') - ])->post( + ] + )->post( url: $requestUrl, data: $postData ); diff --git a/app/Services/Transaction/Category/CategorizeTransactionService.php b/app/Services/Transaction/Category/CategorizeTransactionService.php index 239507b..6d39754 100644 --- a/app/Services/Transaction/Category/CategorizeTransactionService.php +++ b/app/Services/Transaction/Category/CategorizeTransactionService.php @@ -13,7 +13,9 @@ class CategorizeTransactionService { - public function __construct(private readonly TransactionCategorizeService $transactionCategorizeService) {} + public function __construct(private readonly TransactionCategorizeService $transactionCategorizeService) + { + } public function categorizeTransactionsSync(Collection|LazyCollection|array $transactions): float|int { @@ -31,20 +33,24 @@ public function categorizeImportTransactions(mixed $importId): void Transaction::query() ->select('id') ->where('import_id', $importId) - ->chunk(100, function ($transactionsChunk) use (&$categorizationJobs) { - $transactionsIds = collect($transactionsChunk) - ->pluck('id') - ->toArray(); + ->chunk( + 100, function ($transactionsChunk) use (&$categorizationJobs) { + $transactionsIds = collect($transactionsChunk) + ->pluck('id') + ->toArray(); - $categorizationJobs[] = new CategorizeTransactions($transactionsIds); - }); + $categorizationJobs[] = new CategorizeTransactions($transactionsIds); + } + ); // @todo seems like there is not enough chunks generated (only few transactions are being sent) Bus::batch($categorizationJobs) ->name('Import [' . $importId . '] transactions categorization') - ->finally(function () use ($importId) { - event(new ImportCategorizationFinished($importId)); - }) + ->finally( + function () use ($importId) { + event(new ImportCategorizationFinished($importId)); + } + ) ->dispatch(); } } diff --git a/app/Services/Transaction/PersonalAccount/PersonalAccountService.php b/app/Services/Transaction/PersonalAccount/PersonalAccountService.php index 762ee5e..c73f7b4 100644 --- a/app/Services/Transaction/PersonalAccount/PersonalAccountService.php +++ b/app/Services/Transaction/PersonalAccount/PersonalAccountService.php @@ -8,16 +8,19 @@ readonly class PersonalAccountService { public function __construct(private SaldoService $saldoService) - {} + { + } public function createForUser(User $user): PersonalAccount { - return PersonalAccount::firstOrCreate([ + return PersonalAccount::firstOrCreate( + [ 'user_id' => $user->id - ], [ + ], [ 'value' => $this->saldoService->calculate($user), 'user_id' => $user->id, 'name' => 'Default', - ]); + ] + ); } } diff --git a/app/Services/Transaction/PersonalAccount/SaldoService.php b/app/Services/Transaction/PersonalAccount/SaldoService.php index 1ae7fe5..ca846e3 100644 --- a/app/Services/Transaction/PersonalAccount/SaldoService.php +++ b/app/Services/Transaction/PersonalAccount/SaldoService.php @@ -18,7 +18,9 @@ public function calculate(User $user): int { $saldo = 0; foreach (Transaction::whereUser($user)->baseCalculationQuery()->cursor() as $transaction) { - /** @var Transaction $transaction */ + /** + * @var Transaction $transaction +*/ if ($transaction->type === Transaction::TYPE_EXPENDITURE) { $saldo -= $transaction->{Transaction::CALCULATION_COLUMN}; } diff --git a/app/Services/Transaction/Report/ReportService.php b/app/Services/Transaction/Report/ReportService.php index 9e9d8b7..ba65c71 100644 --- a/app/Services/Transaction/Report/ReportService.php +++ b/app/Services/Transaction/Report/ReportService.php @@ -14,11 +14,13 @@ readonly class ReportService { - public function __construct(private CurrencyService $currencyService) {} + public function __construct(private CurrencyService $currencyService) + { + } /** - * @param string|null $rawMonth Date in m-Y format (optional). - * @param mixed $userId + * @param string|null $rawMonth Date in m-Y format (optional). + * @param mixed $userId * @return array Report data. */ public function getPeriodicReport(?string $rawMonth, mixed $userId): array @@ -50,7 +52,9 @@ public function getAvgExpendituresByDays(User $user, Carbon $sinceDate, Carbon $ private function getMonthReport(Carbon $carbon, User $user): array { - /** @var MonthReport $reportTemplate */ + /** + * @var MonthReport $reportTemplate +*/ $reportTemplate = app(MonthReport::class); return $reportTemplate @@ -74,9 +78,11 @@ protected function getBaseTrendQuery(User $user): Builder { return Transaction::whereUser($user) ->baseCalculationQuery() - ->select(DB::raw('transaction_date'), + ->select( + DB::raw('transaction_date'), DB::raw('SUM(calculation_volume) as daily_sum'), - DB::raw('AVG(SUM(calculation_volume)) OVER (ORDER BY transaction_date ASC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) as average_volume')) + DB::raw('AVG(SUM(calculation_volume)) OVER (ORDER BY transaction_date ASC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) as average_volume') + ) ->groupBy('transaction_date') ->orderBy('transaction_date', 'ASC'); } diff --git a/app/Services/Transaction/Settings/UserSettingsService.php b/app/Services/Transaction/Settings/UserSettingsService.php index 230fe1f..01060e5 100644 --- a/app/Services/Transaction/Settings/UserSettingsService.php +++ b/app/Services/Transaction/Settings/UserSettingsService.php @@ -9,9 +9,11 @@ class UserSettingsService { public function assureUserSettings(User $user): Settings { - return Settings::firstOrCreate([ + return Settings::firstOrCreate( + [ 'user_id' => $user->id, 'base_currency_code' => config('moneypenny.base_calculation_currency') - ]); + ] + ); } } diff --git a/app/Services/Transaction/Similar/SimilarTransactionsService.php b/app/Services/Transaction/Similar/SimilarTransactionsService.php index 4af2f4c..a428658 100644 --- a/app/Services/Transaction/Similar/SimilarTransactionsService.php +++ b/app/Services/Transaction/Similar/SimilarTransactionsService.php @@ -15,7 +15,9 @@ public function getSimilarTransactions(Transaction $transaction): Collection $baseQueryClone = clone $baseQuery; - /** @var Collection $baseQueryResult */ + /** + * @var Collection $baseQueryResult +*/ $baseQueryResult = $baseQueryClone->get(); if ($baseQueryResult->count() < 5) { @@ -69,8 +71,9 @@ private function improveSearchQueryWithToken(Transaction $transaction, Builder $ $baseQueryClone ->orWhereRaw('UPPER(description) LIKE ?', ['%' . $onlyLettersToken . '%']) - ->when($transaction->category, fn(Builder $builder) => $builder - ->orWhere('category_id', $transaction->category?->id) + ->when( + $transaction->category, fn(Builder $builder) => $builder + ->orWhere('category_id', $transaction->category?->id) ); } } diff --git a/app/Services/Transaction/Synchronization/SynchronizationService.php b/app/Services/Transaction/Synchronization/SynchronizationService.php index 0ace4ab..931f01a 100644 --- a/app/Services/Transaction/Synchronization/SynchronizationService.php +++ b/app/Services/Transaction/Synchronization/SynchronizationService.php @@ -15,7 +15,9 @@ readonly class SynchronizationService { - public function __construct(private NotificationBroadcastService $notificationBroadcastService) {} + public function __construct(private NotificationBroadcastService $notificationBroadcastService) + { + } public function all(User $user): Collection { @@ -107,7 +109,9 @@ public function handlePeriodicSynchronization(): void ->get() ->first(); - /** @var Carbon $carbon */ + /** + * @var Carbon $carbon +*/ $carbon = $lastSuccessfulSync->created_at; if (now()->diffInHours($carbon) > 4) { diff --git a/app/Services/Transaction/TransactionPersonaService.php b/app/Services/Transaction/TransactionPersonaService.php index b6941e2..203e260 100644 --- a/app/Services/Transaction/TransactionPersonaService.php +++ b/app/Services/Transaction/TransactionPersonaService.php @@ -13,7 +13,9 @@ class TransactionPersonaService public const ACCEPTED_SIMILARITY_PERCENTAGE = 10; - /** @noinspection PhpUndefinedMethodInspection */ + /** + * @noinspection PhpUndefinedMethodInspection + */ public function createPersonasAssociations(Transaction $transaction): void { $transactionId = $transaction->id; @@ -31,10 +33,12 @@ public function createPersonasAssociations(Transaction $transaction): void $senderAssociatedPersona = $this->findOrCreateAssociation($senderSearchColumnData, $senderAccountNumber); $receiverAssociatedPersona = $this->findOrCreateAssociation($receiverSearchColumnData, $receiverAccountNumber); - Transaction::where('id', $transactionId)->update([ + Transaction::where('id', $transactionId)->update( + [ 'sender_persona_id' => $senderAssociatedPersona->id, 'receiver_persona_id' => $receiverAssociatedPersona->id - ]); + ] + ); } protected function findOrCreateAssociation(?string $personaName, ?string $personaAccountNumber): Persona @@ -55,11 +59,13 @@ protected function findOrCreateAssociation(?string $personaName, ?string $person $associatedNamesDataEncoded = json_encode($associatedNamesData); - $persona = Persona::create([ + $persona = Persona::create( + [ 'common_name' => $commonName ?? Persona::NAME_UNKNOWN, 'account_number' => $personaAccountNumber ?? Persona::ACCOUNT_NUMBER_UNKNOWN, 'associated_names' => $associatedNamesDataEncoded - ]); + ] + ); } return $persona; @@ -99,7 +105,9 @@ protected function getPersonaAccountNumberSearchRules(): array ]; } - /** @noinspection PhpUndefinedMethodInspection */ + /** + * @noinspection PhpUndefinedMethodInspection + */ protected function findPersonaByExactlySameName(string $personaName): ?Persona { $value = $this->getStringNormalizedForAssociation($personaName); @@ -120,7 +128,9 @@ protected function getStringNormalizedForAssociation(string $string): string return StringHelper::removeAccents($string); } - /** @noinspection PhpUndefinedMethodInspection */ + /** + * @noinspection PhpUndefinedMethodInspection + */ protected function findPersonaByAvgAssociatedNamesSimilarity(string $personaName): ?Persona { $personaName = $this->getStringNormalizedForAssociation($personaName); @@ -129,26 +139,28 @@ protected function findPersonaByAvgAssociatedNamesSimilarity(string $personaName $personasContainingLongestWordCursor = Persona::where('associated_names', 'like', '%' . $longestWord . '%')->cursor(); $avgSimilarityRates = $personasContainingLongestWordCursor - ->map(function (Persona $persona) use ($personaName) { - $associatedNames = json_decode($persona->associated_names); - $similarityPercentageRates = []; + ->map( + function (Persona $persona) use ($personaName) { + $associatedNames = json_decode($persona->associated_names); + $similarityPercentageRates = []; - foreach ($associatedNames as $associatedName) { - similar_text($associatedName, $personaName, $percentage); - $similarityPercentageRates[] = $percentage; - } + foreach ($associatedNames as $associatedName) { + similar_text($associatedName, $personaName, $percentage); + $similarityPercentageRates[] = $percentage; + } - $averageSimilarity = array_sum($similarityPercentageRates) / count($similarityPercentageRates); + $averageSimilarity = array_sum($similarityPercentageRates) / count($similarityPercentageRates); - if ($averageSimilarity < self::ACCEPTED_SIMILARITY_PERCENTAGE) { - return null; - } + if ($averageSimilarity < self::ACCEPTED_SIMILARITY_PERCENTAGE) { + return null; + } - return [ + return [ 'persona' => $persona, 'avg_similarity_rate' => $averageSimilarity, - ]; - })->filter(); + ]; + } + )->filter(); $mostSimilar = null; @@ -160,7 +172,9 @@ protected function findPersonaByAvgAssociatedNamesSimilarity(string $personaName return $mostSimilar; } - /** @noinspection PhpUndefinedMethodInspection */ + /** + * @noinspection PhpUndefinedMethodInspection + */ protected function findPersonaByAccountNumber(string $accountNumber): ?Persona { return Persona::where('account_number', $accountNumber)->get()->first(); @@ -175,10 +189,12 @@ protected function updatePersonaNames(Persona $persona, ?string $personaName): v $associatedNames[] = $personaName; $newCommonName = $this->getNamesCommonParts($associatedNames, $personaName); - $persona->update([ + $persona->update( + [ 'associated_names' => $associatedNames, 'common_name' => $newCommonName - ]); + ] + ); } } diff --git a/app/Services/Transaction/TransactionService.php b/app/Services/Transaction/TransactionService.php index 9fb3178..7e871c6 100644 --- a/app/Services/Transaction/TransactionService.php +++ b/app/Services/Transaction/TransactionService.php @@ -14,7 +14,8 @@ class TransactionService { public function __construct(private readonly SimilarTransactionsService $similarTransactionsService) - {} + { + } public function getIndexData(Filter $filter, User $user): array { @@ -45,7 +46,9 @@ public function findOrFail(mixed $id, User $user): ?Transaction 'receiverPersona', ]; - /** @var Transaction $transaction */ + /** + * @var Transaction $transaction +*/ $transaction = Transaction::with($relationsToLoad)->findOrFail($id); if ($transaction->user_id !== $user->id) { diff --git a/app/Services/Transaction/Transformers/DateGroupByToCalendar.php b/app/Services/Transaction/Transformers/DateGroupByToCalendar.php index 79997c1..dfe549b 100644 --- a/app/Services/Transaction/Transformers/DateGroupByToCalendar.php +++ b/app/Services/Transaction/Transformers/DateGroupByToCalendar.php @@ -11,7 +11,9 @@ class DateGroupByToCalendar extends Transformer public static function transform(mixed $data, string $dateKey, string $valueKey): Collection { // @todo - refactor - /** @var Collection $data */ + /** + * @var Collection $data +*/ $datesData = $data->toArray(); $result = collect(); @@ -48,24 +50,28 @@ public static function transform(mixed $data, string $dateKey, string $valueKey) } } - $result->push([ + $result->push( + [ 'date' => $dayString, 'total' => $valueData - ]); + ] + ); } // @todo ASAP - rm this hack - return $result->map(function($record, $ix) use ($result) { - $total = data_get($record, 'total'); - if ($total <= 0) { - $nextIx = intval($ix) + 3; - $nextRecord = $result->get($nextIx); - if ($nextRecord) { - $nextTotal = data_get($nextRecord, 'total'); - $record['total'] = $nextTotal; + return $result->map( + function ($record, $ix) use ($result) { + $total = data_get($record, 'total'); + if ($total <= 0) { + $nextIx = intval($ix) + 3; + $nextRecord = $result->get($nextIx); + if ($nextRecord) { + $nextTotal = data_get($nextRecord, 'total'); + $record['total'] = $nextTotal; + } } + return $record; } - return $record; - }); + ); } } diff --git a/composer.json b/composer.json index ba9f293..05be46d 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,8 @@ "nunomaduro/collision": "^7.0", "nunomaduro/larastan": "^2.0", "phpunit/phpunit": "^10.0", - "spatie/laravel-ignition": "^2.0" + "spatie/laravel-ignition": "^2.0", + "squizlabs/php_codesniffer": "^3.8" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index d370793..bc25f56 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4642aadedca03b800a684db3c2674f6d", + "content-hash": "cf3bea42dea3c96e95bd362f16a4fcd3", "packages": [ { "name": "barryvdh/laravel-debugbar", @@ -10718,6 +10718,86 @@ ], "time": "2023-08-23T06:24:34+00:00" }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.8.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5805f7a4e4958dbb5e944ef1e6edae0a303765e7", + "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2023-12-08T12:32:31+00:00" + }, { "name": "symfony/yaml", "version": "v6.3.3", @@ -10847,7 +10927,8 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^8.2" + "php": "^8.2", + "ext-pdo": "*" }, "platform-dev": [], "plugin-api-version": "2.6.0" diff --git a/config/app.php b/config/app.php index 9513108..006e355 100644 --- a/config/app.php +++ b/config/app.php @@ -217,8 +217,10 @@ | */ - 'aliases' => Facade::defaultAliases()->merge([ + 'aliases' => Facade::defaultAliases()->merge( + [ // 'ExampleClass' => App\Example\ExampleClass::class, - ])->toArray(), + ] + )->toArray(), ]; diff --git a/config/database.php b/config/database.php index 7d445ae..fb6dab5 100644 --- a/config/database.php +++ b/config/database.php @@ -58,9 +58,11 @@ 'prefix_indexes' => true, 'strict' => true, 'engine' => null, - 'options' => extension_loaded('pdo_mysql') ? array_filter([ + 'options' => extension_loaded('pdo_mysql') ? array_filter( + [ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), - ]) : [], + ] + ) : [], ], 'mysql_testing' => [ diff --git a/config/sanctum.php b/config/sanctum.php index 3e7a54e..1963d4e 100644 --- a/config/sanctum.php +++ b/config/sanctum.php @@ -15,11 +15,15 @@ | */ - 'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( - '%s%s', - 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1,localhost:80,http://localhost:80', - Sanctum::currentApplicationUrlWithPort() - ))), + 'stateful' => explode( + ',', env( + 'SANCTUM_STATEFUL_DOMAINS', sprintf( + '%s%s', + 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1,localhost:80,http://localhost:80', + Sanctum::currentApplicationUrlWithPort() + ) + ) + ), /* |-------------------------------------------------------------------------- diff --git a/database/factories/Import/ImportFactory.php b/database/factories/Import/ImportFactory.php index c2a1014..523fdd6 100644 --- a/database/factories/Import/ImportFactory.php +++ b/database/factories/Import/ImportFactory.php @@ -20,13 +20,15 @@ class ImportFactory extends Factory */ public function definition(): array { - $randomStatus = $this->faker->randomElement([ + $randomStatus = $this->faker->randomElement( + [ Import::STATUS_SAVED, Import::STATUS_IMPORTED, Import::STATUS_IMPORTING, Import::STATUS_PROCESSING, Import::STATUS_IMPORT_ERROR - ]); + ] + ); return [ 'status' => $randomStatus, diff --git a/database/factories/Transaction/TransactionFactory.php b/database/factories/Transaction/TransactionFactory.php index b6f4e2f..e010de9 100644 --- a/database/factories/Transaction/TransactionFactory.php +++ b/database/factories/Transaction/TransactionFactory.php @@ -17,10 +17,12 @@ public function definition(): array 2 ); - $type = $this->faker->randomElement([ + $type = $this->faker->randomElement( + [ Transaction::TYPE_INCOME, Transaction::TYPE_EXPENDITURE - ]); + ] + ); return [ 'is_excluded_from_calculation' => $this->faker->boolean(), diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 38fb906..11f3064 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -31,9 +31,11 @@ public function definition(): array */ public function unverified(): static { - return $this->state(fn (array $attributes) => [ + return $this->state( + fn (array $attributes) => [ 'email_verified_at' => null, - ]); + ] + ); } /** @@ -41,8 +43,10 @@ public function unverified(): static */ public function admin(): static { - return $this->state(fn (array $attributes) => [ + return $this->state( + fn (array $attributes) => [ 'is_admin' => true, - ]); + ] + ); } } diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 444fafb..4cee33c 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -11,15 +11,17 @@ */ public function up(): void { - Schema::create('users', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table->string('email')->unique(); - $table->timestamp('email_verified_at')->nullable(); - $table->string('password'); - $table->rememberToken(); - $table->timestamps(); - }); + Schema::create( + 'users', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table->string('email')->unique(); + $table->timestamp('email_verified_at')->nullable(); + $table->string('password'); + $table->rememberToken(); + $table->timestamps(); + } + ); } /** diff --git a/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php b/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php index 81a7229..827bf90 100644 --- a/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php +++ b/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php @@ -11,11 +11,13 @@ */ public function up(): void { - Schema::create('password_reset_tokens', function (Blueprint $table) { - $table->string('email')->primary(); - $table->string('token'); - $table->timestamp('created_at')->nullable(); - }); + Schema::create( + 'password_reset_tokens', function (Blueprint $table) { + $table->string('email')->primary(); + $table->string('token'); + $table->timestamp('created_at')->nullable(); + } + ); } /** diff --git a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php index 249da81..81a495d 100644 --- a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php +++ b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php @@ -11,15 +11,17 @@ */ public function up(): void { - Schema::create('failed_jobs', function (Blueprint $table) { - $table->id(); - $table->string('uuid')->unique(); - $table->text('connection'); - $table->text('queue'); - $table->longText('payload'); - $table->longText('exception'); - $table->timestamp('failed_at')->useCurrent(); - }); + Schema::create( + 'failed_jobs', function (Blueprint $table) { + $table->id(); + $table->string('uuid')->unique(); + $table->text('connection'); + $table->text('queue'); + $table->longText('payload'); + $table->longText('exception'); + $table->timestamp('failed_at')->useCurrent(); + } + ); } /** diff --git a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php index e828ad8..83e2066 100644 --- a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php +++ b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php @@ -11,16 +11,18 @@ */ public function up(): void { - Schema::create('personal_access_tokens', function (Blueprint $table) { - $table->id(); - $table->morphs('tokenable'); - $table->string('name'); - $table->string('token', 64)->unique(); - $table->text('abilities')->nullable(); - $table->timestamp('last_used_at')->nullable(); - $table->timestamp('expires_at')->nullable(); - $table->timestamps(); - }); + Schema::create( + 'personal_access_tokens', function (Blueprint $table) { + $table->id(); + $table->morphs('tokenable'); + $table->string('name'); + $table->string('token', 64)->unique(); + $table->text('abilities')->nullable(); + $table->timestamp('last_used_at')->nullable(); + $table->timestamp('expires_at')->nullable(); + $table->timestamps(); + } + ); } /** diff --git a/database/migrations/2023_04_06_210329_create_import_settings_table.php b/database/migrations/2023_04_06_210329_create_import_settings_table.php index b00abd2..d4459d9 100644 --- a/database/migrations/2023_04_06_210329_create_import_settings_table.php +++ b/database/migrations/2023_04_06_210329_create_import_settings_table.php @@ -11,17 +11,19 @@ */ public function up(): void { - Schema::create('import_settings', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table->unsignedTinyInteger('start_row'); - $table->string('file_extension'); - $table->string('delimiter'); - $table->string('enclosure')->nullable(); - $table->string('escape_character')->nullable(); - $table->string('input_encoding')->nullable(); - $table->timestamps(); - }); + Schema::create( + 'import_settings', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table->unsignedTinyInteger('start_row'); + $table->string('file_extension'); + $table->string('delimiter'); + $table->string('enclosure')->nullable(); + $table->string('escape_character')->nullable(); + $table->string('input_encoding')->nullable(); + $table->timestamps(); + } + ); } /** diff --git a/database/migrations/2023_04_06_210330_create_files_table.php b/database/migrations/2023_04_06_210330_create_files_table.php index 81421b8..91079cd 100644 --- a/database/migrations/2023_04_06_210330_create_files_table.php +++ b/database/migrations/2023_04_06_210330_create_files_table.php @@ -11,18 +11,20 @@ */ public function up(): void { - Schema::create('files', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table->string('path'); - $table->integer('size'); - $table - ->foreignId('import_setting_id') - ->nullable() - ->constrained('import_settings') - ->nullOnDelete(); - $table->timestamps(); - }); + Schema::create( + 'files', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table->string('path'); + $table->integer('size'); + $table + ->foreignId('import_setting_id') + ->nullable() + ->constrained('import_settings') + ->nullOnDelete(); + $table->timestamps(); + } + ); } /** diff --git a/database/migrations/2023_04_07_113635_create_columns_mappings_table.php b/database/migrations/2023_04_07_113635_create_columns_mappings_table.php index 119812d..f8dd369 100644 --- a/database/migrations/2023_04_07_113635_create_columns_mappings_table.php +++ b/database/migrations/2023_04_07_113635_create_columns_mappings_table.php @@ -11,18 +11,20 @@ */ public function up(): void { - Schema::create('columns_mappings', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table->unsignedSmallInteger('transaction_date_column_index')->nullable(); - $table->unsignedSmallInteger('accounting_date_column_index')->nullable(); - $table->unsignedSmallInteger('volume_column_index')->nullable(); - $table->unsignedSmallInteger('sender_column_index')->nullable(); - $table->unsignedSmallInteger('receiver_column_index')->nullable(); - $table->unsignedSmallInteger('description_column_index')->nullable(); - $table->unsignedSmallInteger('currency_column_index')->nullable(); - $table->timestamps(); - }); + Schema::create( + 'columns_mappings', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table->unsignedSmallInteger('transaction_date_column_index')->nullable(); + $table->unsignedSmallInteger('accounting_date_column_index')->nullable(); + $table->unsignedSmallInteger('volume_column_index')->nullable(); + $table->unsignedSmallInteger('sender_column_index')->nullable(); + $table->unsignedSmallInteger('receiver_column_index')->nullable(); + $table->unsignedSmallInteger('description_column_index')->nullable(); + $table->unsignedSmallInteger('currency_column_index')->nullable(); + $table->timestamps(); + } + ); } /** diff --git a/database/migrations/2023_04_07_113636_create_imports_table.php b/database/migrations/2023_04_07_113636_create_imports_table.php index d854a77..6afd003 100644 --- a/database/migrations/2023_04_07_113636_create_imports_table.php +++ b/database/migrations/2023_04_07_113636_create_imports_table.php @@ -11,26 +11,28 @@ */ public function up(): void { - Schema::create('imports', function (Blueprint $table) { - $table->id(); - $table->tinyInteger('status'); - $table - ->foreignId('import_setting_id') - ->nullable() - ->constrained('import_settings') - ->nullOnDelete(); - $table - ->foreignId('columns_mapping_id') - ->nullable() - ->constrained('columns_mappings') - ->nullOnDelete(); - $table - ->foreignId('file_id') - ->nullable() - ->constrained('files') - ->nullOnDelete(); - $table->timestamps(); - }); + Schema::create( + 'imports', function (Blueprint $table) { + $table->id(); + $table->tinyInteger('status'); + $table + ->foreignId('import_setting_id') + ->nullable() + ->constrained('import_settings') + ->nullOnDelete(); + $table + ->foreignId('columns_mapping_id') + ->nullable() + ->constrained('columns_mappings') + ->nullOnDelete(); + $table + ->foreignId('file_id') + ->nullable() + ->constrained('files') + ->nullOnDelete(); + $table->timestamps(); + } + ); } /** diff --git a/database/migrations/2023_04_07_134640_create_transactions_table.php b/database/migrations/2023_04_07_134640_create_transactions_table.php index 47f2646..34c7bc0 100644 --- a/database/migrations/2023_04_07_134640_create_transactions_table.php +++ b/database/migrations/2023_04_07_134640_create_transactions_table.php @@ -11,26 +11,28 @@ */ public function up(): void { - Schema::create('transactions', function (Blueprint $table) { - $table->id(); - $table->date('transaction_date')->nullable(); - $table->date('accounting_date')->nullable(); - $table->string('sender')->nullable(); - $table->string('raw_volume')->nullable(); - $table->decimal('decimal_volume')->nullable(); - $table - ->unsignedTinyInteger('type') - ->default(Transaction::TYPE_UNKNOWN) - ->nullable(); - $table->string('receiver')->nullable(); - $table->text('description')->nullable(); - $table->string('currency')->nullable(); - $table - ->foreignId('import_id') - ->constrained('imports') - ->cascadeOnDelete(); - $table->timestamps(); - }); + Schema::create( + 'transactions', function (Blueprint $table) { + $table->id(); + $table->date('transaction_date')->nullable(); + $table->date('accounting_date')->nullable(); + $table->string('sender')->nullable(); + $table->string('raw_volume')->nullable(); + $table->decimal('decimal_volume')->nullable(); + $table + ->unsignedTinyInteger('type') + ->default(Transaction::TYPE_UNKNOWN) + ->nullable(); + $table->string('receiver')->nullable(); + $table->text('description')->nullable(); + $table->string('currency')->nullable(); + $table + ->foreignId('import_id') + ->constrained('imports') + ->cascadeOnDelete(); + $table->timestamps(); + } + ); } /** diff --git a/database/migrations/2023_04_09_154834_create_nordigen_end_user_agreements_table.php b/database/migrations/2023_04_09_154834_create_nordigen_end_user_agreements_table.php index 0cba7f6..1dac9d2 100644 --- a/database/migrations/2023_04_09_154834_create_nordigen_end_user_agreements_table.php +++ b/database/migrations/2023_04_09_154834_create_nordigen_end_user_agreements_table.php @@ -11,16 +11,18 @@ */ public function up(): void { - Schema::create('nordigen_end_user_agreements', function (Blueprint $table) { - $table->id(); - $table->boolean('is_successful')->default(false); - $table->json('raw_request_body'); - $table->json('raw_response_body'); - $table->string('nordigen_institution_id')->nullable(); - $table->string('nordigen_end_user_agreement_id')->nullable(); - $table->dateTime('nordigen_end_user_agreement_created')->nullable(); - $table->timestamps(); - }); + Schema::create( + 'nordigen_end_user_agreements', function (Blueprint $table) { + $table->id(); + $table->boolean('is_successful')->default(false); + $table->json('raw_request_body'); + $table->json('raw_response_body'); + $table->string('nordigen_institution_id')->nullable(); + $table->string('nordigen_end_user_agreement_id')->nullable(); + $table->dateTime('nordigen_end_user_agreement_created')->nullable(); + $table->timestamps(); + } + ); } /** diff --git a/database/migrations/2023_04_09_170907_create_nordigen_requisitions_table.php b/database/migrations/2023_04_09_170907_create_nordigen_requisitions_table.php index f79a794..588d1a9 100644 --- a/database/migrations/2023_04_09_170907_create_nordigen_requisitions_table.php +++ b/database/migrations/2023_04_09_170907_create_nordigen_requisitions_table.php @@ -11,21 +11,23 @@ */ public function up(): void { - Schema::create('nordigen_requisitions', function (Blueprint $table) { - $table->id(); - $table->uuid('reference'); - $table->json('raw_request_body'); - $table->json('raw_response_body'); - $table->string('link', 512); - $table->string('nordigen_institution_id'); - $table->string('nordigen_requisition_id'); - $table - ->foreignId('end_user_agreement_id') - ->references('id') - ->on('nordigen_end_user_agreements') - ->cascadeOnDelete(); - $table->timestamps(); - }); + Schema::create( + 'nordigen_requisitions', function (Blueprint $table) { + $table->id(); + $table->uuid('reference'); + $table->json('raw_request_body'); + $table->json('raw_response_body'); + $table->string('link', 512); + $table->string('nordigen_institution_id'); + $table->string('nordigen_requisition_id'); + $table + ->foreignId('end_user_agreement_id') + ->references('id') + ->on('nordigen_end_user_agreements') + ->cascadeOnDelete(); + $table->timestamps(); + } + ); } /** diff --git a/database/migrations/2023_04_10_225503_create_synchronizations_table.php b/database/migrations/2023_04_10_225503_create_synchronizations_table.php index 9ccf9cc..d2eb515 100644 --- a/database/migrations/2023_04_10_225503_create_synchronizations_table.php +++ b/database/migrations/2023_04_10_225503_create_synchronizations_table.php @@ -11,10 +11,12 @@ */ public function up(): void { - Schema::create('synchronizations', function (Blueprint $table) { - $table->id(); - $table->timestamps(); - }); + Schema::create( + 'synchronizations', function (Blueprint $table) { + $table->id(); + $table->timestamps(); + } + ); } /** diff --git a/database/migrations/2023_04_10_225930_create_accounts_table.php b/database/migrations/2023_04_10_225930_create_accounts_table.php index c80dd79..3603165 100644 --- a/database/migrations/2023_04_10_225930_create_accounts_table.php +++ b/database/migrations/2023_04_10_225930_create_accounts_table.php @@ -11,11 +11,13 @@ */ public function up(): void { - Schema::create('accounts', function (Blueprint $table) { - $table->id(); - $table->string('nordigen_account_id'); - $table->timestamps(); - }); + Schema::create( + 'accounts', function (Blueprint $table) { + $table->id(); + $table->string('nordigen_account_id'); + $table->timestamps(); + } + ); } /** diff --git a/database/migrations/2023_04_10_230033_create_personal_accounts_table.php b/database/migrations/2023_04_10_230033_create_personal_accounts_table.php index 1a44e8a..1f7576d 100644 --- a/database/migrations/2023_04_10_230033_create_personal_accounts_table.php +++ b/database/migrations/2023_04_10_230033_create_personal_accounts_table.php @@ -11,16 +11,18 @@ */ public function up(): void { - Schema::create('personal_accounts', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table->decimal('value', 9)->nullable(); - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - $table->timestamps(); - }); + Schema::create( + 'personal_accounts', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table->decimal('value', 9)->nullable(); + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + $table->timestamps(); + } + ); } /** diff --git a/database/migrations/2023_04_10_230034_add_personal_account_id_to_transactions_table.php b/database/migrations/2023_04_10_230034_add_personal_account_id_to_transactions_table.php index 98ee58a..b1bc7b4 100644 --- a/database/migrations/2023_04_10_230034_add_personal_account_id_to_transactions_table.php +++ b/database/migrations/2023_04_10_230034_add_personal_account_id_to_transactions_table.php @@ -11,13 +11,15 @@ */ public function up(): void { - Schema::table('transactions', function (Blueprint $table) { - $table - ->foreignId('personal_account_id') - ->nullable() - ->constrained('personal_accounts') - ->cascadeOnDelete(); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table + ->foreignId('personal_account_id') + ->nullable() + ->constrained('personal_accounts') + ->cascadeOnDelete(); + } + ); } /** @@ -25,8 +27,10 @@ public function up(): void */ public function down(): void { - Schema::table('transactions', function (Blueprint $table) { - $table->dropColumn('personal_account_id'); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table->dropColumn('personal_account_id'); + } + ); } }; diff --git a/database/migrations/2023_04_11_000852_make_import_id_nullable_at_transactions_table.php b/database/migrations/2023_04_11_000852_make_import_id_nullable_at_transactions_table.php index 5885f2a..3c5f7db 100644 --- a/database/migrations/2023_04_11_000852_make_import_id_nullable_at_transactions_table.php +++ b/database/migrations/2023_04_11_000852_make_import_id_nullable_at_transactions_table.php @@ -11,12 +11,14 @@ */ public function up(): void { - Schema::table('transactions', function (Blueprint $table) { - $table - ->foreignId('import_id') - ->nullable() - ->change(); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table + ->foreignId('import_id') + ->nullable() + ->change(); + } + ); } /** @@ -24,11 +26,13 @@ public function up(): void */ public function down(): void { - Schema::table('transactions', function (Blueprint $table) { - $table - ->foreignId('import_id') - ->nullable(false) - ->change(); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table + ->foreignId('import_id') + ->nullable(false) + ->change(); + } + ); } }; diff --git a/database/migrations/2023_04_11_002309_add_synchronization_id_column_to_accounts.php b/database/migrations/2023_04_11_002309_add_synchronization_id_column_to_accounts.php index 4431e99..60f2556 100644 --- a/database/migrations/2023_04_11_002309_add_synchronization_id_column_to_accounts.php +++ b/database/migrations/2023_04_11_002309_add_synchronization_id_column_to_accounts.php @@ -11,13 +11,15 @@ */ public function up(): void { - Schema::table('accounts', function (Blueprint $table) { - $table - ->foreignId('synchronization_id') - ->nullable() - ->constrained('synchronizations') - ->cascadeOnDelete(); - }); + Schema::table( + 'accounts', function (Blueprint $table) { + $table + ->foreignId('synchronization_id') + ->nullable() + ->constrained('synchronizations') + ->cascadeOnDelete(); + } + ); } /** @@ -25,8 +27,10 @@ public function up(): void */ public function down(): void { - Schema::table('accounts', function (Blueprint $table) { - $table->dropColumn('synchronization_id'); - }); + Schema::table( + 'accounts', function (Blueprint $table) { + $table->dropColumn('synchronization_id'); + } + ); } }; diff --git a/database/migrations/2023_04_11_104023_add_status_column_to_synchronizations.php b/database/migrations/2023_04_11_104023_add_status_column_to_synchronizations.php index 9584561..1b2aa76 100644 --- a/database/migrations/2023_04_11_104023_add_status_column_to_synchronizations.php +++ b/database/migrations/2023_04_11_104023_add_status_column_to_synchronizations.php @@ -12,11 +12,13 @@ */ public function up(): void { - Schema::table('synchronizations', function (Blueprint $table) { - $table - ->tinyInteger('status') - ->default(Synchronization::SYNC_STATUS_RUNNING); - }); + Schema::table( + 'synchronizations', function (Blueprint $table) { + $table + ->tinyInteger('status') + ->default(Synchronization::SYNC_STATUS_RUNNING); + } + ); } /** @@ -24,8 +26,10 @@ public function up(): void */ public function down(): void { - Schema::table('synchronizations', function (Blueprint $table) { - $table->dropColumn('status'); - }); + Schema::table( + 'synchronizations', function (Blueprint $table) { + $table->dropColumn('status'); + } + ); } }; diff --git a/database/migrations/2023_04_13_115538_create_exchange_rates_table.php b/database/migrations/2023_04_13_115538_create_exchange_rates_table.php index 59869b2..99df2d9 100644 --- a/database/migrations/2023_04_13_115538_create_exchange_rates_table.php +++ b/database/migrations/2023_04_13_115538_create_exchange_rates_table.php @@ -11,13 +11,15 @@ */ public function up(): void { - Schema::create('exchange_rates', function (Blueprint $table) { - $table->id(); - $table->string('base_currency'); - $table->string('target_currency'); - $table->date('rate_source_date'); - $table->timestamps(); - }); + Schema::create( + 'exchange_rates', function (Blueprint $table) { + $table->id(); + $table->string('base_currency'); + $table->string('target_currency'); + $table->date('rate_source_date'); + $table->timestamps(); + } + ); } /** diff --git a/database/migrations/2023_04_13_123017_add_rate_to_exchange_rates.php b/database/migrations/2023_04_13_123017_add_rate_to_exchange_rates.php index d0545e4..8861c4a 100644 --- a/database/migrations/2023_04_13_123017_add_rate_to_exchange_rates.php +++ b/database/migrations/2023_04_13_123017_add_rate_to_exchange_rates.php @@ -11,9 +11,11 @@ */ public function up(): void { - Schema::table('exchange_rates', function (Blueprint $table) { - $table->decimal('rate', 16, 6); - }); + Schema::table( + 'exchange_rates', function (Blueprint $table) { + $table->decimal('rate', 16, 6); + } + ); } /** @@ -21,8 +23,10 @@ public function up(): void */ public function down(): void { - Schema::table('exchange_rates', function (Blueprint $table) { - $table->dropColumn('rate'); - }); + Schema::table( + 'exchange_rates', function (Blueprint $table) { + $table->dropColumn('rate'); + } + ); } }; diff --git a/database/migrations/2023_04_13_132206_add_calculation_volume_to_transactions.php b/database/migrations/2023_04_13_132206_add_calculation_volume_to_transactions.php index 0414816..031301c 100644 --- a/database/migrations/2023_04_13_132206_add_calculation_volume_to_transactions.php +++ b/database/migrations/2023_04_13_132206_add_calculation_volume_to_transactions.php @@ -11,9 +11,11 @@ */ public function up(): void { - Schema::table('transactions', function (Blueprint $table) { - $table->decimal('calculation_volume', 9)->nullable(); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table->decimal('calculation_volume', 9)->nullable(); + } + ); } /** @@ -21,8 +23,10 @@ public function up(): void */ public function down(): void { - Schema::table('transactions', function (Blueprint $table) { - $table->dropColumn('calculation_volume'); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table->dropColumn('calculation_volume'); + } + ); } }; diff --git a/database/migrations/2023_04_22_155233_add_synchronization_id_to_imports.php b/database/migrations/2023_04_22_155233_add_synchronization_id_to_imports.php index e691008..b1eccb6 100644 --- a/database/migrations/2023_04_22_155233_add_synchronization_id_to_imports.php +++ b/database/migrations/2023_04_22_155233_add_synchronization_id_to_imports.php @@ -11,13 +11,15 @@ */ public function up(): void { - Schema::table('imports', function (Blueprint $table) { - $table - ->foreignId('synchronization_id') - ->nullable() - ->constrained('synchronizations') - ->nullOnDelete(); - }); + Schema::table( + 'imports', function (Blueprint $table) { + $table + ->foreignId('synchronization_id') + ->nullable() + ->constrained('synchronizations') + ->nullOnDelete(); + } + ); } /** @@ -25,8 +27,10 @@ public function up(): void */ public function down(): void { - Schema::table('imports', function (Blueprint $table) { - $table->dropColumn('synchronization_id'); - }); + Schema::table( + 'imports', function (Blueprint $table) { + $table->dropColumn('synchronization_id'); + } + ); } }; diff --git a/database/migrations/2023_04_22_155257_make_file_id_column_nullable_at_imports.php b/database/migrations/2023_04_22_155257_make_file_id_column_nullable_at_imports.php index 00cf0c5..116b042 100644 --- a/database/migrations/2023_04_22_155257_make_file_id_column_nullable_at_imports.php +++ b/database/migrations/2023_04_22_155257_make_file_id_column_nullable_at_imports.php @@ -11,12 +11,14 @@ */ public function up(): void { - Schema::table('imports', function (Blueprint $table) { - $table - ->foreignId('file_id') - ->nullable() - ->change(); - }); + Schema::table( + 'imports', function (Blueprint $table) { + $table + ->foreignId('file_id') + ->nullable() + ->change(); + } + ); } /** @@ -24,11 +26,13 @@ public function up(): void */ public function down(): void { - Schema::table('imports', function (Blueprint $table) { - $table - ->foreignId('file_id') - ->nullable(false) - ->change(); - }); + Schema::table( + 'imports', function (Blueprint $table) { + $table + ->foreignId('file_id') + ->nullable(false) + ->change(); + } + ); } }; diff --git a/database/migrations/2023_04_22_161039_add_transactions_statistics_columns_to_imports.php b/database/migrations/2023_04_22_161039_add_transactions_statistics_columns_to_imports.php index 85d0405..790c718 100644 --- a/database/migrations/2023_04_22_161039_add_transactions_statistics_columns_to_imports.php +++ b/database/migrations/2023_04_22_161039_add_transactions_statistics_columns_to_imports.php @@ -11,9 +11,11 @@ */ public function up(): void { - Schema::table('imports', function (Blueprint $table) { - $table->unsignedInteger('transactions_skipped_count')->default(0); - }); + Schema::table( + 'imports', function (Blueprint $table) { + $table->unsignedInteger('transactions_skipped_count')->default(0); + } + ); } /** @@ -21,8 +23,10 @@ public function up(): void */ public function down(): void { - Schema::table('imports', function (Blueprint $table) { - $table->dropColumn('transactions_skipped_count'); - }); + Schema::table( + 'imports', function (Blueprint $table) { + $table->dropColumn('transactions_skipped_count'); + } + ); } }; diff --git a/database/migrations/2023_04_22_164514_make_columns_nullable_at_imports.php b/database/migrations/2023_04_22_164514_make_columns_nullable_at_imports.php index 2ae8a5f..5c8a5f6 100644 --- a/database/migrations/2023_04_22_164514_make_columns_nullable_at_imports.php +++ b/database/migrations/2023_04_22_164514_make_columns_nullable_at_imports.php @@ -11,10 +11,12 @@ */ public function up(): void { - Schema::table('imports', function (Blueprint $table) { - $table->foreignId('import_setting_id')->nullable()->change(); - $table->foreignId('columns_mapping_id')->nullable()->change(); - }); + Schema::table( + 'imports', function (Blueprint $table) { + $table->foreignId('import_setting_id')->nullable()->change(); + $table->foreignId('columns_mapping_id')->nullable()->change(); + } + ); } /** @@ -22,9 +24,11 @@ public function up(): void */ public function down(): void { - Schema::table('imports', function (Blueprint $table) { - $table->foreignId('import_setting_id')->nullable(false)->change(); - $table->foreignId('columns_mapping_id')->nullable(false)->change(); - }); + Schema::table( + 'imports', function (Blueprint $table) { + $table->foreignId('import_setting_id')->nullable(false)->change(); + $table->foreignId('columns_mapping_id')->nullable(false)->change(); + } + ); } }; diff --git a/database/migrations/2023_04_27_202046_create_personas_table.php b/database/migrations/2023_04_27_202046_create_personas_table.php index 568e2e8..f901b01 100644 --- a/database/migrations/2023_04_27_202046_create_personas_table.php +++ b/database/migrations/2023_04_27_202046_create_personas_table.php @@ -11,12 +11,14 @@ */ public function up(): void { - Schema::create('personas', function (Blueprint $table) { - $table->id(); - $table->string('common_name'); - $table->json('associated_names'); - $table->timestamps(); - }); + Schema::create( + 'personas', function (Blueprint $table) { + $table->id(); + $table->string('common_name'); + $table->json('associated_names'); + $table->timestamps(); + } + ); } /** diff --git a/database/migrations/2023_04_27_203334_add_personas_columns_to_transactions.php b/database/migrations/2023_04_27_203334_add_personas_columns_to_transactions.php index 49212cf..442bfde 100644 --- a/database/migrations/2023_04_27_203334_add_personas_columns_to_transactions.php +++ b/database/migrations/2023_04_27_203334_add_personas_columns_to_transactions.php @@ -11,20 +11,22 @@ */ public function up(): void { - Schema::table('transactions', function (Blueprint $table) { - $table - ->foreignId('sender_persona_id') - ->nullable() - ->references('id') - ->on('personas') - ->cascadeOnDelete(); - $table - ->foreignId('receiver_persona_id') - ->nullable() - ->references('id') - ->on('personas') - ->cascadeOnDelete(); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table + ->foreignId('sender_persona_id') + ->nullable() + ->references('id') + ->on('personas') + ->cascadeOnDelete(); + $table + ->foreignId('receiver_persona_id') + ->nullable() + ->references('id') + ->on('personas') + ->cascadeOnDelete(); + } + ); } /** @@ -32,9 +34,11 @@ public function up(): void */ public function down(): void { - Schema::table('transactions', function (Blueprint $table) { - $table->dropColumn('sender_persona_id'); - $table->dropColumn('receiver_persona_id'); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table->dropColumn('sender_persona_id'); + $table->dropColumn('receiver_persona_id'); + } + ); } }; diff --git a/database/migrations/2023_04_28_103900_add_sender_account_number_to_transactions.php b/database/migrations/2023_04_28_103900_add_sender_account_number_to_transactions.php index 3496a0e..080fc27 100644 --- a/database/migrations/2023_04_28_103900_add_sender_account_number_to_transactions.php +++ b/database/migrations/2023_04_28_103900_add_sender_account_number_to_transactions.php @@ -11,9 +11,11 @@ */ public function up(): void { - Schema::table('transactions', function (Blueprint $table) { - $table->string('sender_account_number', 512)->nullable(); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table->string('sender_account_number', 512)->nullable(); + } + ); } /** @@ -21,8 +23,10 @@ public function up(): void */ public function down(): void { - Schema::table('transactions', function (Blueprint $table) { - $table->dropColumn('sender_account_number'); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table->dropColumn('sender_account_number'); + } + ); } }; diff --git a/database/migrations/2023_04_28_103924_add_receiver_account_number_to_transactions.php b/database/migrations/2023_04_28_103924_add_receiver_account_number_to_transactions.php index f73a831..3872c40 100644 --- a/database/migrations/2023_04_28_103924_add_receiver_account_number_to_transactions.php +++ b/database/migrations/2023_04_28_103924_add_receiver_account_number_to_transactions.php @@ -11,9 +11,11 @@ */ public function up(): void { - Schema::table('transactions', function (Blueprint $table) { - $table->string('receiver_account_number', 512)->nullable(); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table->string('receiver_account_number', 512)->nullable(); + } + ); } /** @@ -21,8 +23,10 @@ public function up(): void */ public function down(): void { - Schema::table('transactions', function (Blueprint $table) { - $table->dropColumn('receiver_account_number')->nullable(); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table->dropColumn('receiver_account_number')->nullable(); + } + ); } }; diff --git a/database/migrations/2023_04_28_103943_add_account_number_to_personas.php b/database/migrations/2023_04_28_103943_add_account_number_to_personas.php index 517e475..c8b0748 100644 --- a/database/migrations/2023_04_28_103943_add_account_number_to_personas.php +++ b/database/migrations/2023_04_28_103943_add_account_number_to_personas.php @@ -11,9 +11,11 @@ */ public function up(): void { - Schema::table('personas', function (Blueprint $table) { - $table->string('account_number', 512); - }); + Schema::table( + 'personas', function (Blueprint $table) { + $table->string('account_number', 512); + } + ); } /** @@ -21,8 +23,10 @@ public function up(): void */ public function down(): void { - Schema::table('personas', function (Blueprint $table) { - $table->dropColumn('account_number'); - }); + Schema::table( + 'personas', function (Blueprint $table) { + $table->dropColumn('account_number'); + } + ); } }; diff --git a/database/migrations/2023_04_28_104434_add_sender_and_receiver_account_numbers_columns_indexes_to_columns_mappings.php b/database/migrations/2023_04_28_104434_add_sender_and_receiver_account_numbers_columns_indexes_to_columns_mappings.php index 4893351..eebf5c9 100644 --- a/database/migrations/2023_04_28_104434_add_sender_and_receiver_account_numbers_columns_indexes_to_columns_mappings.php +++ b/database/migrations/2023_04_28_104434_add_sender_and_receiver_account_numbers_columns_indexes_to_columns_mappings.php @@ -11,10 +11,12 @@ */ public function up(): void { - Schema::table('columns_mappings', function (Blueprint $table) { - $table->unsignedSmallInteger('sender_account_number_column_index')->nullable(); - $table->unsignedSmallInteger('receiver_account_number_column_index')->nullable(); - }); + Schema::table( + 'columns_mappings', function (Blueprint $table) { + $table->unsignedSmallInteger('sender_account_number_column_index')->nullable(); + $table->unsignedSmallInteger('receiver_account_number_column_index')->nullable(); + } + ); } /** @@ -22,9 +24,11 @@ public function up(): void */ public function down(): void { - Schema::table('columns_mappings', function (Blueprint $table) { - $table->dropColumn('sender_account_number_column_index'); - $table->dropColumn('receiver_account_number_column_index'); - }); + Schema::table( + 'columns_mappings', function (Blueprint $table) { + $table->dropColumn('sender_account_number_column_index'); + $table->dropColumn('receiver_account_number_column_index'); + } + ); } }; diff --git a/database/migrations/2023_04_28_190306_create_reports_table.php b/database/migrations/2023_04_28_190306_create_reports_table.php index e1c37af..80bc52a 100644 --- a/database/migrations/2023_04_28_190306_create_reports_table.php +++ b/database/migrations/2023_04_28_190306_create_reports_table.php @@ -11,11 +11,13 @@ */ public function up(): void { - Schema::create('reports', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table->timestamps(); - }); + Schema::create( + 'reports', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table->timestamps(); + } + ); } /** diff --git a/database/migrations/2023_05_02_052307_create_report_fields_table.php b/database/migrations/2023_05_02_052307_create_report_fields_table.php index 5442ae3..80326e6 100644 --- a/database/migrations/2023_05_02_052307_create_report_fields_table.php +++ b/database/migrations/2023_05_02_052307_create_report_fields_table.php @@ -11,18 +11,20 @@ */ public function up(): void { - Schema::create('report_fields', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table->unsignedTinyInteger('type'); - $table->string('value')->nullable(); - $table - ->foreignId('report_id') - ->references('id') - ->on('reports') - ->cascadeOnDelete(); - $table->timestamps(); - }); + Schema::create( + 'report_fields', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table->unsignedTinyInteger('type'); + $table->string('value')->nullable(); + $table + ->foreignId('report_id') + ->references('id') + ->on('reports') + ->cascadeOnDelete(); + $table->timestamps(); + } + ); } /** diff --git a/database/migrations/2023_05_02_052658_add_parent_report_field_id_to_report_fields.php b/database/migrations/2023_05_02_052658_add_parent_report_field_id_to_report_fields.php index f3c2307..92712ba 100644 --- a/database/migrations/2023_05_02_052658_add_parent_report_field_id_to_report_fields.php +++ b/database/migrations/2023_05_02_052658_add_parent_report_field_id_to_report_fields.php @@ -11,14 +11,16 @@ */ public function up(): void { - Schema::table('report_fields', function (Blueprint $table) { - $table - ->foreignId('parent_report_field_id') - ->nullable() - ->references('id') - ->on('report_fields') - ->cascadeOnDelete(); - }); + Schema::table( + 'report_fields', function (Blueprint $table) { + $table + ->foreignId('parent_report_field_id') + ->nullable() + ->references('id') + ->on('report_fields') + ->cascadeOnDelete(); + } + ); } /** @@ -26,8 +28,10 @@ public function up(): void */ public function down(): void { - Schema::table('report_fields', function (Blueprint $table) { - $table->dropColumn('parent_report_field_id'); - }); + Schema::table( + 'report_fields', function (Blueprint $table) { + $table->dropColumn('parent_report_field_id'); + } + ); } }; diff --git a/database/migrations/2023_05_07_212854_create_notifications_table.php b/database/migrations/2023_05_07_212854_create_notifications_table.php index a1d07b2..873f7e4 100644 --- a/database/migrations/2023_05_07_212854_create_notifications_table.php +++ b/database/migrations/2023_05_07_212854_create_notifications_table.php @@ -12,22 +12,24 @@ */ public function up(): void { - Schema::create('notifications', function (Blueprint $table) { - $table->id(); - $table->json('content'); - $table - ->unsignedTinyInteger('type') - ->default(Notification::TYPE_INFO); - $table - ->unsignedTinyInteger('status') - ->default(Notification::STATUS_UNREAD); - $table - ->foreignId('user_id') - ->nullable() - ->constrained('users') - ->cascadeOnDelete(); - $table->timestamps(); - }); + Schema::create( + 'notifications', function (Blueprint $table) { + $table->id(); + $table->json('content'); + $table + ->unsignedTinyInteger('type') + ->default(Notification::TYPE_INFO); + $table + ->unsignedTinyInteger('status') + ->default(Notification::STATUS_UNREAD); + $table + ->foreignId('user_id') + ->nullable() + ->constrained('users') + ->cascadeOnDelete(); + $table->timestamps(); + } + ); } /** diff --git a/database/migrations/2023_05_21_130609_add_user_id_to_transactions.php b/database/migrations/2023_05_21_130609_add_user_id_to_transactions.php index 1e3919f..8410b3d 100644 --- a/database/migrations/2023_05_21_130609_add_user_id_to_transactions.php +++ b/database/migrations/2023_05_21_130609_add_user_id_to_transactions.php @@ -8,18 +8,22 @@ { public function up(): void { - Schema::table('transactions', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + } + ); } public function down(): void { - Schema::table('transactions', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + } + ); } }; diff --git a/database/migrations/2023_05_21_131546_add_user_id_to_synchronizations.php b/database/migrations/2023_05_21_131546_add_user_id_to_synchronizations.php index a62060e..ee70a8a 100644 --- a/database/migrations/2023_05_21_131546_add_user_id_to_synchronizations.php +++ b/database/migrations/2023_05_21_131546_add_user_id_to_synchronizations.php @@ -8,18 +8,22 @@ { public function up(): void { - Schema::table('synchronizations', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - }); + Schema::table( + 'synchronizations', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + } + ); } public function down(): void { - Schema::table('synchronizations', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - }); + Schema::table( + 'synchronizations', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + } + ); } }; diff --git a/database/migrations/2023_05_21_131952_add_user_id_to_nordigen_requisitions.php b/database/migrations/2023_05_21_131952_add_user_id_to_nordigen_requisitions.php index 20b3c97..de13586 100644 --- a/database/migrations/2023_05_21_131952_add_user_id_to_nordigen_requisitions.php +++ b/database/migrations/2023_05_21_131952_add_user_id_to_nordigen_requisitions.php @@ -8,18 +8,22 @@ { public function up(): void { - Schema::table('nordigen_requisitions', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - }); + Schema::table( + 'nordigen_requisitions', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + } + ); } public function down(): void { - Schema::table('nordigen_requisitions', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - }); + Schema::table( + 'nordigen_requisitions', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + } + ); } }; diff --git a/database/migrations/2023_05_21_132635_add_user_id_to_accounts.php b/database/migrations/2023_05_21_132635_add_user_id_to_accounts.php index b7e54cd..046a030 100644 --- a/database/migrations/2023_05_21_132635_add_user_id_to_accounts.php +++ b/database/migrations/2023_05_21_132635_add_user_id_to_accounts.php @@ -8,18 +8,22 @@ { public function up(): void { - Schema::table('accounts', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - }); + Schema::table( + 'accounts', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + } + ); } public function down(): void { - Schema::table('accounts', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - }); + Schema::table( + 'accounts', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + } + ); } }; diff --git a/database/migrations/2023_05_21_133012_add_user_id_to_files.php b/database/migrations/2023_05_21_133012_add_user_id_to_files.php index 05f075e..1c3e513 100644 --- a/database/migrations/2023_05_21_133012_add_user_id_to_files.php +++ b/database/migrations/2023_05_21_133012_add_user_id_to_files.php @@ -8,18 +8,22 @@ { public function up(): void { - Schema::table('files', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - }); + Schema::table( + 'files', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + } + ); } public function down(): void { - Schema::table('files', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - }); + Schema::table( + 'files', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + } + ); } }; diff --git a/database/migrations/2023_05_21_133551_add_user_id_to_columns_mappings.php b/database/migrations/2023_05_21_133551_add_user_id_to_columns_mappings.php index 53e0e6f..9b859aa 100644 --- a/database/migrations/2023_05_21_133551_add_user_id_to_columns_mappings.php +++ b/database/migrations/2023_05_21_133551_add_user_id_to_columns_mappings.php @@ -8,18 +8,22 @@ { public function up(): void { - Schema::table('columns_mappings', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - }); + Schema::table( + 'columns_mappings', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + } + ); } public function down(): void { - Schema::table('columns_mappings', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - }); + Schema::table( + 'columns_mappings', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + } + ); } }; diff --git a/database/migrations/2023_05_21_133809_add_user_id_to_imports.php b/database/migrations/2023_05_21_133809_add_user_id_to_imports.php index e4fac58..706329a 100644 --- a/database/migrations/2023_05_21_133809_add_user_id_to_imports.php +++ b/database/migrations/2023_05_21_133809_add_user_id_to_imports.php @@ -8,18 +8,22 @@ { public function up(): void { - Schema::table('imports', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - }); + Schema::table( + 'imports', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + } + ); } public function down(): void { - Schema::table('imports', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - }); + Schema::table( + 'imports', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + } + ); } }; diff --git a/database/migrations/2023_05_21_134604_add_user_id_to_nordigen_end_user_agreements.php b/database/migrations/2023_05_21_134604_add_user_id_to_nordigen_end_user_agreements.php index 1aa11c2..434c320 100644 --- a/database/migrations/2023_05_21_134604_add_user_id_to_nordigen_end_user_agreements.php +++ b/database/migrations/2023_05_21_134604_add_user_id_to_nordigen_end_user_agreements.php @@ -8,18 +8,22 @@ { public function up(): void { - Schema::table('nordigen_end_user_agreements', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - }); + Schema::table( + 'nordigen_end_user_agreements', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + } + ); } public function down(): void { - Schema::table('nordigen_end_user_agreements', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - }); + Schema::table( + 'nordigen_end_user_agreements', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + } + ); } }; diff --git a/database/migrations/2023_05_21_144237_add_user_id_to_import_settings.php b/database/migrations/2023_05_21_144237_add_user_id_to_import_settings.php index d78d561..8051626 100644 --- a/database/migrations/2023_05_21_144237_add_user_id_to_import_settings.php +++ b/database/migrations/2023_05_21_144237_add_user_id_to_import_settings.php @@ -11,12 +11,14 @@ */ public function up(): void { - Schema::table('import_settings', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - }); + Schema::table( + 'import_settings', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + } + ); } /** @@ -24,8 +26,10 @@ public function up(): void */ public function down(): void { - Schema::table('import_settings', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - }); + Schema::table( + 'import_settings', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + } + ); } }; diff --git a/database/migrations/2023_05_23_110548_add_is_admin_to_users.php b/database/migrations/2023_05_23_110548_add_is_admin_to_users.php index 6cbfbc3..22fbc3a 100644 --- a/database/migrations/2023_05_23_110548_add_is_admin_to_users.php +++ b/database/migrations/2023_05_23_110548_add_is_admin_to_users.php @@ -8,15 +8,19 @@ { public function up(): void { - Schema::table('users', function (Blueprint $table) { - $table->boolean('is_admin')->default(false); - }); + Schema::table( + 'users', function (Blueprint $table) { + $table->boolean('is_admin')->default(false); + } + ); } public function down(): void { - Schema::table('users', function (Blueprint $table) { - $table->dropColumn('is_admin'); - }); + Schema::table( + 'users', function (Blueprint $table) { + $table->dropColumn('is_admin'); + } + ); } }; diff --git a/database/migrations/2023_05_25_213554_create_jobs_table.php b/database/migrations/2023_05_25_213554_create_jobs_table.php index 6098d9b..a63a61b 100644 --- a/database/migrations/2023_05_25_213554_create_jobs_table.php +++ b/database/migrations/2023_05_25_213554_create_jobs_table.php @@ -11,15 +11,17 @@ */ public function up(): void { - Schema::create('jobs', function (Blueprint $table) { - $table->bigIncrements('id'); - $table->string('queue')->index(); - $table->longText('payload'); - $table->unsignedTinyInteger('attempts'); - $table->unsignedInteger('reserved_at')->nullable(); - $table->unsignedInteger('available_at'); - $table->unsignedInteger('created_at'); - }); + Schema::create( + 'jobs', function (Blueprint $table) { + $table->bigIncrements('id'); + $table->string('queue')->index(); + $table->longText('payload'); + $table->unsignedTinyInteger('attempts'); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + } + ); } /** diff --git a/database/migrations/2023_05_26_171457_create_settings_table.php b/database/migrations/2023_05_26_171457_create_settings_table.php index f9f0c2d..6e92823 100644 --- a/database/migrations/2023_05_26_171457_create_settings_table.php +++ b/database/migrations/2023_05_26_171457_create_settings_table.php @@ -8,17 +8,19 @@ { public function up(): void { - Schema::create('settings', function (Blueprint $table) { - $table->id(); - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - $table - ->string('base_currency_code') - ->default(config('moneypenny.base_calculation_currency')); - $table->timestamps(); - }); + Schema::create( + 'settings', function (Blueprint $table) { + $table->id(); + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + $table + ->string('base_currency_code') + ->default(config('moneypenny.base_calculation_currency')); + $table->timestamps(); + } + ); } public function down(): void diff --git a/database/migrations/2023_05_26_193636_create_categories_table.php b/database/migrations/2023_05_26_193636_create_categories_table.php index ae80341..1e54ec4 100644 --- a/database/migrations/2023_05_26_193636_create_categories_table.php +++ b/database/migrations/2023_05_26_193636_create_categories_table.php @@ -8,11 +8,13 @@ { public function up(): void { - Schema::create('categories', function (Blueprint $table) { - $table->id(); - $table->string('code'); - $table->timestamps(); - }); + Schema::create( + 'categories', function (Blueprint $table) { + $table->id(); + $table->string('code'); + $table->timestamps(); + } + ); } public function down(): void diff --git a/database/migrations/2023_05_26_193833_add_category_id_to_transactions.php b/database/migrations/2023_05_26_193833_add_category_id_to_transactions.php index ee56072..4257d7a 100644 --- a/database/migrations/2023_05_26_193833_add_category_id_to_transactions.php +++ b/database/migrations/2023_05_26_193833_add_category_id_to_transactions.php @@ -8,19 +8,23 @@ { public function up(): void { - Schema::table('transactions', function (Blueprint $table) { - $table - ->foreignId('category_id') - ->nullable() - ->constrained('categories') - ->nullOnDelete(); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table + ->foreignId('category_id') + ->nullable() + ->constrained('categories') + ->nullOnDelete(); + } + ); } public function down(): void { - Schema::table('transactions', function (Blueprint $table) { - $table->dropColumn('category_id'); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table->dropColumn('category_id'); + } + ); } }; diff --git a/database/migrations/2023_05_27_122301_create_job_batches_table.php b/database/migrations/2023_05_27_122301_create_job_batches_table.php index 50e38c2..8fe8ced 100644 --- a/database/migrations/2023_05_27_122301_create_job_batches_table.php +++ b/database/migrations/2023_05_27_122301_create_job_batches_table.php @@ -11,18 +11,20 @@ */ public function up(): void { - Schema::create('job_batches', function (Blueprint $table) { - $table->string('id')->primary(); - $table->string('name'); - $table->integer('total_jobs'); - $table->integer('pending_jobs'); - $table->integer('failed_jobs'); - $table->longText('failed_job_ids'); - $table->mediumText('options')->nullable(); - $table->integer('cancelled_at')->nullable(); - $table->integer('created_at'); - $table->integer('finished_at')->nullable(); - }); + Schema::create( + 'job_batches', function (Blueprint $table) { + $table->string('id')->primary(); + $table->string('name'); + $table->integer('total_jobs'); + $table->integer('pending_jobs'); + $table->integer('failed_jobs'); + $table->longText('failed_job_ids'); + $table->mediumText('options')->nullable(); + $table->integer('cancelled_at')->nullable(); + $table->integer('created_at'); + $table->integer('finished_at')->nullable(); + } + ); } /** diff --git a/database/migrations/2023_05_28_170228_create_budgets_table.php b/database/migrations/2023_05_28_170228_create_budgets_table.php index 122203f..e6d0bf6 100644 --- a/database/migrations/2023_05_28_170228_create_budgets_table.php +++ b/database/migrations/2023_05_28_170228_create_budgets_table.php @@ -9,21 +9,23 @@ { public function up(): void { - Schema::create('budgets', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table - ->unsignedSmallInteger('type') - ->default(Budget::TYPE_MONTH); - $table - ->decimal('amount') - ->nullable(); - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - $table->timestamps(); - }); + Schema::create( + 'budgets', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table + ->unsignedSmallInteger('type') + ->default(Budget::TYPE_MONTH); + $table + ->decimal('amount') + ->nullable(); + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + $table->timestamps(); + } + ); } public function down(): void diff --git a/database/migrations/2023_06_01_102325_add_is_blocked_to_users.php b/database/migrations/2023_06_01_102325_add_is_blocked_to_users.php index 05057ea..024e630 100644 --- a/database/migrations/2023_06_01_102325_add_is_blocked_to_users.php +++ b/database/migrations/2023_06_01_102325_add_is_blocked_to_users.php @@ -8,15 +8,19 @@ { public function up(): void { - Schema::table('users', function (Blueprint $table) { - $table->boolean('is_blocked')->default(false); - }); + Schema::table( + 'users', function (Blueprint $table) { + $table->boolean('is_blocked')->default(false); + } + ); } public function down(): void { - Schema::table('users', function (Blueprint $table) { - $table->dropColumn('is_blocked'); - }); + Schema::table( + 'users', function (Blueprint $table) { + $table->dropColumn('is_blocked'); + } + ); } }; diff --git a/database/migrations/2023_06_05_104930_add_code_to_synchronizations.php b/database/migrations/2023_06_05_104930_add_code_to_synchronizations.php index 6e057f0..f8975a1 100644 --- a/database/migrations/2023_06_05_104930_add_code_to_synchronizations.php +++ b/database/migrations/2023_06_05_104930_add_code_to_synchronizations.php @@ -8,15 +8,19 @@ { public function up(): void { - Schema::table('synchronizations', function (Blueprint $table) { - $table->smallInteger('code'); - }); + Schema::table( + 'synchronizations', function (Blueprint $table) { + $table->smallInteger('code'); + } + ); } public function down(): void { - Schema::table('synchronizations', function (Blueprint $table) { - $table->dropColumn('code'); - }); + Schema::table( + 'synchronizations', function (Blueprint $table) { + $table->dropColumn('code'); + } + ); } }; diff --git a/database/migrations/2023_06_05_105419_make_code_column_nullable_at_synchronizations.php b/database/migrations/2023_06_05_105419_make_code_column_nullable_at_synchronizations.php index 1f51eb6..128eca8 100644 --- a/database/migrations/2023_06_05_105419_make_code_column_nullable_at_synchronizations.php +++ b/database/migrations/2023_06_05_105419_make_code_column_nullable_at_synchronizations.php @@ -8,21 +8,25 @@ { public function up(): void { - Schema::table('synchronizations', function (Blueprint $table) { - $table - ->smallInteger('code') - ->nullable() - ->change(); - }); + Schema::table( + 'synchronizations', function (Blueprint $table) { + $table + ->smallInteger('code') + ->nullable() + ->change(); + } + ); } public function down(): void { - Schema::table('synchronizations', function (Blueprint $table) { - $table - ->smallInteger('code') - ->nullable(false) - ->change(); - }); + Schema::table( + 'synchronizations', function (Blueprint $table) { + $table + ->smallInteger('code') + ->nullable(false) + ->change(); + } + ); } }; diff --git a/database/migrations/2023_06_16_015635_add_color_hex_to_categories.php b/database/migrations/2023_06_16_015635_add_color_hex_to_categories.php index afdd76e..83f60b3 100644 --- a/database/migrations/2023_06_16_015635_add_color_hex_to_categories.php +++ b/database/migrations/2023_06_16_015635_add_color_hex_to_categories.php @@ -11,9 +11,11 @@ */ public function up(): void { - Schema::table('categories', function (Blueprint $table) { - $table->string('color_hex', 7)->nullable(); - }); + Schema::table( + 'categories', function (Blueprint $table) { + $table->string('color_hex', 7)->nullable(); + } + ); } /** @@ -21,8 +23,10 @@ public function up(): void */ public function down(): void { - Schema::table('categories', function (Blueprint $table) { - $table->dropColumn('color_hex'); - }); + Schema::table( + 'categories', function (Blueprint $table) { + $table->dropColumn('color_hex'); + } + ); } }; diff --git a/database/migrations/2023_06_22_132234_change_amount_column_length_at_budgets.php b/database/migrations/2023_06_22_132234_change_amount_column_length_at_budgets.php index 5702416..83843c5 100644 --- a/database/migrations/2023_06_22_132234_change_amount_column_length_at_budgets.php +++ b/database/migrations/2023_06_22_132234_change_amount_column_length_at_budgets.php @@ -8,21 +8,25 @@ { public function up(): void { - Schema::table('budgets', function (Blueprint $table) { - $table - ->decimal('amount', 12) - ->nullable() - ->change(); - }); + Schema::table( + 'budgets', function (Blueprint $table) { + $table + ->decimal('amount', 12) + ->nullable() + ->change(); + } + ); } public function down(): void { - Schema::table('budgets', function (Blueprint $table) { - $table - ->decimal('amount') - ->nullable() - ->change(); - }); + Schema::table( + 'budgets', function (Blueprint $table) { + $table + ->decimal('amount') + ->nullable() + ->change(); + } + ); } }; diff --git a/database/migrations/2023_12_26_171157_add_is_excluded_from_calculation_column_to_transactions_table.php b/database/migrations/2023_12_26_171157_add_is_excluded_from_calculation_column_to_transactions_table.php index 4508e54..8c08a16 100644 --- a/database/migrations/2023_12_26_171157_add_is_excluded_from_calculation_column_to_transactions_table.php +++ b/database/migrations/2023_12_26_171157_add_is_excluded_from_calculation_column_to_transactions_table.php @@ -8,17 +8,21 @@ { public function up(): void { - Schema::table('transactions', function (Blueprint $table) { - $table - ->boolean('is_excluded_from_calculation') - ->default(false); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table + ->boolean('is_excluded_from_calculation') + ->default(false); + } + ); } public function down(): void { - Schema::table('transactions', function (Blueprint $table) { - $table->dropColumn('is_excluded_from_calculation'); - }); + Schema::table( + 'transactions', function (Blueprint $table) { + $table->dropColumn('is_excluded_from_calculation'); + } + ); } }; diff --git a/database/seeders/ColumnsMappingsTableSeeder.php b/database/seeders/ColumnsMappingsTableSeeder.php index da4adda..6f34fdc 100644 --- a/database/seeders/ColumnsMappingsTableSeeder.php +++ b/database/seeders/ColumnsMappingsTableSeeder.php @@ -13,7 +13,8 @@ class ColumnsMappingsTableSeeder extends Seeder */ public function run(): void { - ColumnsMapping::create([ + ColumnsMapping::create( + [ 'user_id' => User::first()->id, 'name' => 'Alior Export', 'transaction_date_column_index' => 0, @@ -25,6 +26,7 @@ public function run(): void 'currency_column_index' => 6, 'sender_account_number_column_index' => 9, 'receiver_account_number_column_index' => 10, - ]); + ] + ); } } diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index ec54a3b..90b5891 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -22,13 +22,15 @@ public function run(): void return; } - $this->call([ + $this->call( + [ UsersTableSeeder::class, ImportSettingsTableSeeder::class, ColumnsMappingsTableSeeder::class, CategoriesTableSeeder::class, TransactionsTableSeeder::class, FilesTableSeeder::class, - ]); + ] + ); } } diff --git a/database/seeders/FilesTableSeeder.php b/database/seeders/FilesTableSeeder.php index 75dc2db..acc8ab1 100644 --- a/database/seeders/FilesTableSeeder.php +++ b/database/seeders/FilesTableSeeder.php @@ -17,13 +17,15 @@ class FilesTableSeeder extends Seeder public function run(): void { for ($i = 1; $i <= 10; $i++) { - File::create([ + File::create( + [ 'user_id' => User::inRandomOrder()->first()->id, 'name' => "file{$i}.csv", 'path' => "files/file{$i}.csv", 'import_setting_id' => ImportSetting::inRandomOrder()->first()->id, 'size' => rand(1024, 2048), - ]); + ] + ); } } } diff --git a/database/seeders/UsersTableSeeder.php b/database/seeders/UsersTableSeeder.php index 8f624c1..8c66211 100644 --- a/database/seeders/UsersTableSeeder.php +++ b/database/seeders/UsersTableSeeder.php @@ -14,19 +14,23 @@ class UsersTableSeeder extends Seeder public function run(): void { try { - User::factory()->create([ + User::factory()->create( + [ 'name' => 'Test User', 'email' => 'test@example.com', - ]); + ] + ); } catch (Throwable) { $this->command->warn(' ⚠️ Test user already exists.'); } try { - User::factory()->create([ + User::factory()->create( + [ 'name' => 'Guest User', 'email' => 'guest@example.com', - ]); + ] + ); } catch (Throwable) { $this->command->warn(' ⚠️ Guest user already exists.'); } @@ -34,10 +38,12 @@ public function run(): void try { User::factory() ->admin() - ->create([ + ->create( + [ 'name' => 'Admin User', 'email' => 'admin@example.com', - ]); + ] + ); } catch (Throwable) { $this->command->warn(' ⚠️ Admin user already exists.'); } diff --git a/resources/js/getCookie.js b/resources/js/getCookie.js index 0726014..fd20407 100644 --- a/resources/js/getCookie.js +++ b/resources/js/getCookie.js @@ -3,8 +3,10 @@ export const getCookie = (cname) => { let ca = document.cookie.split(';'); for (let i = 0; i < ca.length; i++) { let c = ca[i]; - while (c.charAt(0) === ' ') c = c.substring(1); - if (c.indexOf(name) !== -1) return c.substring(name.length, c.length); + while (c.charAt(0) === ' ') { c = c.substring(1); + } + if (c.indexOf(name) !== -1) { return c.substring(name.length, c.length); + } } return ""; } diff --git a/tailwind.config.js b/tailwind.config.js index 14f4a42..c2ce13a 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,6 +1,8 @@ const defaultTheme = require('tailwindcss/defaultTheme'); -/** @type {import('tailwindcss').Config} */ +/** + * @type {import('tailwindcss').Config} + */ module.exports = { darkMode: 'dark', From 8ff94021d675329a2e94615e8093590910b84d4c Mon Sep 17 00:00:00 2001 From: mike Date: Thu, 28 Dec 2023 02:22:51 +0100 Subject: [PATCH 2/4] Revert "Add php version to matrix github action" This reverts commit 3deb34476281a499362846c81ddabce8c633feb7. --- .github/workflows/php_test.yml | 2 +- .../ExchangeRates/PullExchangeRates.php | 6 +- .../SendApplicationNotification.php | 2 +- app/Console/Commands/Setup/SetupApp.php | 18 ++-- .../AssociatePersonasToTransactions.php | 20 ++-- .../CategorizeAllTransactionsDebug.php | 32 +++---- .../CopyDecimalVolumeToCalculationVolume.php | 16 ++-- .../Transaction/CreateSettingsForUsers.php | 12 +-- .../Transaction/SetAccountSaldoForUser.php | 12 +-- .../Transaction/ShowTransactionsPersonas.php | 4 +- .../UpdateTypesBasedOnRawVolume.php | 16 ++-- app/Console/Kernel.php | 2 +- .../ApplicationNotificationSent.php | 3 +- .../Category/ImportCategorizationFinished.php | 4 +- app/Exceptions/Handler.php | 14 +-- app/Filters/Filter.php | 4 +- .../Controllers/Api/Auth/UserController.php | 18 ++-- .../FileExplorer/FileExplorerController.php | 21 ++--- .../Notification/NotificationController.php | 10 +- .../Api/Profile/ProfileController.php | 4 +- .../SynchronizationController.php | 9 +- .../Analytics/AnalyticsController.php | 4 +- .../Api/Transaction/ReportController.php | 16 +--- .../Auth/ConfirmablePasswordController.php | 13 +-- .../Controllers/Web/Auth/DeviceController.php | 4 +- .../Web/Auth/NewPasswordController.php | 14 +-- .../Web/Auth/PasswordController.php | 12 +-- .../Web/Auth/PasswordResetLinkController.php | 8 +- .../Web/Auth/ProfileController.php | 12 +-- .../Web/Auth/RegisteredUserController.php | 12 +-- .../Controllers/Web/Auth/SetupController.php | 10 +- .../ExchangeRates/ExchangeRateController.php | 4 +- .../Controllers/Web/File/FileController.php | 9 +- .../Web/Import/ImportController.php | 4 +- .../Web/Import/ImportSettingController.php | 3 +- .../Institution/InstitutionController.php | 6 +- .../Notification/NotificationController.php | 3 +- .../Controllers/Web/Social/ChatController.php | 3 +- .../SynchronizationController.php | 4 +- .../Web/Transaction/BudgetController.php | 3 +- .../Categorize/CategorizationController.php | 3 +- .../Web/Transaction/CategoryController.php | 2 +- .../Web/Transaction/PersonaController.php | 16 +--- .../Transaction/PersonalAccountController.php | 24 ++--- .../Web/Transaction/ReportController.php | 4 +- .../Web/Transaction/SettingsController.php | 10 +- .../Web/Transaction/TransactionController.php | 17 ++-- .../Controllers/Web/User/UserController.php | 6 +- .../CheckOneTimeRegistrationToken.php | 4 +- .../Middleware/DenyAccessForBlockedUsers.php | 6 +- .../Middleware/RedirectIfAuthenticated.php | 2 +- .../Web/Admin/Notifications/SendRequest.php | 6 +- app/Http/Requests/Web/Auth/LoginRequest.php | 18 ++-- .../Web/Transaction/Budget/PatchRequest.php | 6 +- .../HasJsonFailedValidationResponse.php | 6 +- app/Imports/TransactionsImport.php | 9 +- app/Jobs/Auth/CreateUserSettings.php | 4 +- .../Transaction/CategorizeTransactions.php | 3 +- .../RecategorizeAllTransactions.php | 4 +- .../ResolveTransactionCalculationVolume.php | 10 +- .../SaveTransactionCategoryReference.php | 4 +- .../UpdateUsersPersonalAccountSaldo.php | 4 +- .../Auth/HandleWhenDeviceHijacked.php | 8 +- app/Mixins/AssertableJsonMixin.php | 4 +- app/Mixins/FactoryMixin.php | 8 +- app/Mixins/RouteMixin.php | 19 ++-- app/Models/Auth/Settings.php | 2 +- app/Models/ExchangeRates/ExchangeRate.php | 8 +- app/Models/File.php | 6 +- app/Models/Import/ColumnsMapping.php | 8 +- app/Models/Import/Import.php | 4 +- app/Models/Import/ImportSetting.php | 8 +- app/Models/Nordigen/EndUserAgreement.php | 14 +-- app/Models/Nordigen/Requisition.php | 6 +- app/Models/Notification.php | 4 +- app/Models/Synchronization/Account.php | 8 +- .../Synchronization/Synchronization.php | 6 +- app/Models/Transaction/Category.php | 2 +- app/Models/Transaction/Persona.php | 6 +- app/Models/Transaction/PersonalAccount.php | 2 +- app/Models/Transaction/Transaction.php | 28 +++--- app/Models/User.php | 6 +- app/Observers/Import/ImportObserver.php | 6 +- .../Transaction/TransactionObserver.php | 2 +- app/Providers/BroadcastServiceProvider.php | 2 +- app/Providers/HorizonServiceProvider.php | 14 +-- app/Providers/RouteServiceProvider.php | 22 ++--- app/Providers/TelescopeServiceProvider.php | 34 +++---- app/Services/Analytics/AnalyticsService.php | 4 +- .../ChartQueries/CategoriesPercentage.php | 16 ++-- .../ChartQueries/CategorizedPercentage.php | 6 +- .../Traits/UseGenerateSimilarColors.php | 12 +-- app/Services/Auth/Api/UserService.php | 4 +- app/Services/Auth/Device/DeviceService.php | 4 +- .../OneTimeToken/TokenRegistrationService.php | 4 +- .../HistoricalExchangeRateDataObject.php | 3 +- .../ExchangeRates/ExchangeRatesService.php | 16 +--- .../Provider/ExchangeRatesServiceProvider.php | 18 ++-- app/Services/File/FileUploadService.php | 9 +- .../RegistersFileInDBAndStoresOnDisk.php | 10 +- app/Services/File/TransactionFileService.php | 4 +- .../FileExplorer/DirectoryRenderBuilder.php | 12 +-- .../FileExplorer/FileRenderBuilder.php | 24 ++--- app/Services/Helpers/StringHelper.php | 9 +- app/Services/Helpers/TimeHelper.php | 8 +- app/Services/Home/HomePageService.php | 9 +- .../Home/HomePageServiceCachingDecorator.php | 3 +- app/Services/Import/ImportService.php | 14 +-- app/Services/Meta/MetaService.php | 13 +-- .../DataObjects/TransactionDataObject.php | 47 ++++------ app/Services/Nordigen/NordigenService.php | 93 +++++++------------ .../Provider/NordigenServiceProvider.php | 16 ++-- .../NotificationBroadcastService.php | 12 +-- .../Budget/BudgetConsumtptionService.php | 10 +- .../Transaction/Budget/BudgetService.php | 9 +- .../Categorize/CategorizationService.php | 7 +- .../Categorize/CategoryReferenceService.php | 8 +- .../TransactionCategorizeService.php | 10 +- .../Category/CategorizeTransactionService.php | 26 ++---- .../PersonalAccountService.php | 11 +-- .../PersonalAccount/SaldoService.php | 4 +- .../Transaction/Report/ReportService.php | 18 ++-- .../Settings/UserSettingsService.php | 6 +- .../Similar/SimilarTransactionsService.php | 9 +- .../SynchronizationService.php | 8 +- .../Transaction/TransactionPersonaService.php | 64 +++++-------- .../Transaction/TransactionService.php | 7 +- .../Transformers/DateGroupByToCalendar.php | 32 +++---- composer.json | 3 +- composer.lock | 85 +---------------- config/app.php | 6 +- config/database.php | 6 +- config/sanctum.php | 14 +-- database/factories/Import/ImportFactory.php | 6 +- .../Transaction/TransactionFactory.php | 6 +- database/factories/UserFactory.php | 12 +-- .../2014_10_12_000000_create_users_table.php | 20 ++-- ...000_create_password_reset_tokens_table.php | 12 +-- ..._08_19_000000_create_failed_jobs_table.php | 20 ++-- ...01_create_personal_access_tokens_table.php | 22 ++--- ...06_210329_create_import_settings_table.php | 24 +++-- .../2023_04_06_210330_create_files_table.php | 26 +++--- ...7_113635_create_columns_mappings_table.php | 26 +++--- ...2023_04_07_113636_create_imports_table.php | 42 ++++----- ...04_07_134640_create_transactions_table.php | 42 ++++----- ...ate_nordigen_end_user_agreements_table.php | 22 ++--- ...907_create_nordigen_requisitions_table.php | 32 +++---- ...0_225503_create_synchronizations_table.php | 10 +- ...023_04_10_225930_create_accounts_table.php | 12 +-- ..._230033_create_personal_accounts_table.php | 22 ++--- ...sonal_account_id_to_transactions_table.php | 24 ++--- ...port_id_nullable_at_transactions_table.php | 28 +++--- ..._synchronization_id_column_to_accounts.php | 24 ++--- ..._add_status_column_to_synchronizations.php | 20 ++-- ..._13_115538_create_exchange_rates_table.php | 16 ++-- ...4_13_123017_add_rate_to_exchange_rates.php | 16 ++-- ...add_calculation_volume_to_transactions.php | 16 ++-- ...5233_add_synchronization_id_to_imports.php | 24 ++--- ...ake_file_id_column_nullable_at_imports.php | 28 +++--- ...sactions_statistics_columns_to_imports.php | 16 ++-- ...64514_make_columns_nullable_at_imports.php | 20 ++-- ...023_04_27_202046_create_personas_table.php | 14 ++- ...4_add_personas_columns_to_transactions.php | 40 ++++---- ..._sender_account_number_to_transactions.php | 16 ++-- ...eceiver_account_number_to_transactions.php | 16 ++-- ..._103943_add_account_number_to_personas.php | 16 ++-- ...rs_columns_indexes_to_columns_mappings.php | 20 ++-- ...2023_04_28_190306_create_reports_table.php | 12 +-- ...5_02_052307_create_report_fields_table.php | 26 +++--- ...arent_report_field_id_to_report_fields.php | 26 +++--- ...5_07_212854_create_notifications_table.php | 34 ++++--- ..._21_130609_add_user_id_to_transactions.php | 22 ++--- ...131546_add_user_id_to_synchronizations.php | 22 ++--- ...2_add_user_id_to_nordigen_requisitions.php | 22 ++--- ...3_05_21_132635_add_user_id_to_accounts.php | 22 ++--- ...2023_05_21_133012_add_user_id_to_files.php | 22 ++--- ...133551_add_user_id_to_columns_mappings.php | 22 ++--- ...23_05_21_133809_add_user_id_to_imports.php | 22 ++--- ...ser_id_to_nordigen_end_user_agreements.php | 22 ++--- ..._144237_add_user_id_to_import_settings.php | 22 ++--- ...023_05_23_110548_add_is_admin_to_users.php | 16 ++-- .../2023_05_25_213554_create_jobs_table.php | 20 ++-- ...023_05_26_171457_create_settings_table.php | 24 +++-- ...3_05_26_193636_create_categories_table.php | 12 +-- ...193833_add_category_id_to_transactions.php | 24 ++--- ..._05_27_122301_create_job_batches_table.php | 26 +++--- ...2023_05_28_170228_create_budgets_table.php | 32 +++---- ...3_06_01_102325_add_is_blocked_to_users.php | 16 ++-- ...05_104930_add_code_to_synchronizations.php | 16 ++-- ...de_column_nullable_at_synchronizations.php | 28 +++--- ..._16_015635_add_color_hex_to_categories.php | 16 ++-- ...change_amount_column_length_at_budgets.php | 28 +++--- ...lculation_column_to_transactions_table.php | 20 ++-- .../seeders/ColumnsMappingsTableSeeder.php | 6 +- database/seeders/DatabaseSeeder.php | 6 +- database/seeders/FilesTableSeeder.php | 6 +- database/seeders/UsersTableSeeder.php | 18 ++-- resources/js/getCookie.js | 6 +- tailwind.config.js | 4 +- 199 files changed, 1077 insertions(+), 1744 deletions(-) diff --git a/.github/workflows/php_test.yml b/.github/workflows/php_test.yml index 8ca9683..1b740b5 100644 --- a/.github/workflows/php_test.yml +++ b/.github/workflows/php_test.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - php: ['8.2', '8.3'] + php: ['8.2'] steps: - uses: actions/checkout@v1 diff --git a/app/Console/Commands/ExchangeRates/PullExchangeRates.php b/app/Console/Commands/ExchangeRates/PullExchangeRates.php index 6e3e245..7bdc4c0 100644 --- a/app/Console/Commands/ExchangeRates/PullExchangeRates.php +++ b/app/Console/Commands/ExchangeRates/PullExchangeRates.php @@ -33,11 +33,9 @@ public function handle(ExchangeRatesServiceInterface $exchangeRatesService): voi $line = "Exchanging $transaction->currency to $defaultCurrency: $exchangeRate->rate * $transaction->decimal_volume = $result"; $this->line($line); - $transaction->update( - [ + $transaction->update([ 'calculation_volume' => $exchangeRate->rate * $transaction->decimal_volume - ] - ); + ]); } } } diff --git a/app/Console/Commands/Notification/SendApplicationNotification.php b/app/Console/Commands/Notification/SendApplicationNotification.php index 563b993..0266cd0 100644 --- a/app/Console/Commands/Notification/SendApplicationNotification.php +++ b/app/Console/Commands/Notification/SendApplicationNotification.php @@ -20,7 +20,7 @@ public function handle(NotificationBroadcastService $notificationBroadcastServic $notificationBroadcastService->sendStoredApplicationNotification( header: $header, - content: $content, + content: $content , url: $url, userId: $userId, ); diff --git a/app/Console/Commands/Setup/SetupApp.php b/app/Console/Commands/Setup/SetupApp.php index 2eb3b6b..ec1a010 100644 --- a/app/Console/Commands/Setup/SetupApp.php +++ b/app/Console/Commands/Setup/SetupApp.php @@ -151,11 +151,9 @@ private function migrateDatabase(): void { $this->info('Migrating database...'); - $exitCode = Artisan::call( - 'migrate', [ + $exitCode = Artisan::call('migrate', [ '--force' => true, - ] - ); + ]); if ($exitCode === 0) { $this->info('Database migrated.'); @@ -173,11 +171,9 @@ private function seedDatabase(): void { $this->info('Seeding database...'); - $exitCode = Artisan::call( - 'db:seed', [ + $exitCode = Artisan::call('db:seed', [ '--force' => true, - ] - ); + ]); if ($exitCode === 0) { $this->info('Database seeded.'); @@ -195,12 +191,10 @@ private function performPostSetupCommands(): void { $this->info('Performing post setup commands...'); - $exitCode = array_sum( - [ + $exitCode = array_sum([ Artisan::call('moneypenny:create-users-personal-accounts'), Artisan::call('moneypenny:create-users-settings') - ] - ); + ]); if ($exitCode === 0) { $this->info('Post setup task performed.'); diff --git a/app/Console/Commands/Transaction/AssociatePersonasToTransactions.php b/app/Console/Commands/Transaction/AssociatePersonasToTransactions.php index dfa4ec3..6927715 100644 --- a/app/Console/Commands/Transaction/AssociatePersonasToTransactions.php +++ b/app/Console/Commands/Transaction/AssociatePersonasToTransactions.php @@ -14,9 +14,7 @@ class AssociatePersonasToTransactions extends Command protected $description = 'Create personas associations for all transactions.'; - /** - * @noinspection PhpUndefinedMethodInspection - */ + /** @noinspection PhpUndefinedMethodInspection */ public function handle(): void { $transactionsCount = Transaction::count(); @@ -24,11 +22,9 @@ public function handle(): void $this->line("Creating associations for $transactionsCount transactions..."); $this->line("* * * * * * * * * * * * * * * * * * * * * * *"); - $this->withProgressBar( - Transaction::cursor(), function (Transaction $transaction) { - $this->performTask($transaction); - } - ); + $this->withProgressBar(Transaction::cursor(), function (Transaction $transaction) { + $this->performTask($transaction); + }); $this->info(PHP_EOL . 'Found personas list:'); @@ -36,18 +32,14 @@ public function handle(): void $personas = Persona::withCount('transactionsAsSender', 'transactionsAsReceiver')->get(); foreach ($personas as $persona) { - /** - * @var Persona $persona -*/ + /** @var Persona $persona */ $associatedNamesCount = count(json_decode($persona->associated_names, true)); $commonNameOutput = trim(StringHelper::shortenAuto($persona->common_name, 25)); $associatedNamesOutput = "$associatedNamesCount : "; $associatedNamesOutput .= trim(StringHelper::shortenAuto($persona->associated_names, 45)); $accountNumberOutput = $persona->account_number; - /** - * @noinspection PhpUndefinedFieldInspection -*/ + /** @noinspection PhpUndefinedFieldInspection */ $personasData[] = [ 'common_name' => $commonNameOutput, 'associated_names' => $associatedNamesOutput, diff --git a/app/Console/Commands/Transaction/CategorizeAllTransactionsDebug.php b/app/Console/Commands/Transaction/CategorizeAllTransactionsDebug.php index 22a59b6..bf44224 100644 --- a/app/Console/Commands/Transaction/CategorizeAllTransactionsDebug.php +++ b/app/Console/Commands/Transaction/CategorizeAllTransactionsDebug.php @@ -42,26 +42,22 @@ public function handle(CategorizeTransactionService $categorizeTransactionServic $chunkCounter = 0; $transactionBaseQuery - ->chunk( - $chunkSize, function (Collection $transactions) use ($categorizeTransactionService, &$chunkCounter) { - try { - $categorizedPercentage = $categorizeTransactionService->categorizeTransactionsSync($transactions); - ++$chunkCounter; - $categorizedFormatted = number_format($categorizedPercentage * 100, 1); - $line = '[' . $chunkCounter . '] Processed chunk. ' . $categorizedFormatted . '% categorized.'; - $this->line($line); - - } catch (Throwable $throwable) { - $this->error('[' . $chunkCounter . '] Processed chunk failed'); - $shortMessage = StringHelper::shortenAuto($throwable->getMessage(), 200); - $this->warn($shortMessage); - } + ->chunk($chunkSize, function (Collection $transactions) use ($categorizeTransactionService, &$chunkCounter) { + try { + $categorizedPercentage = $categorizeTransactionService->categorizeTransactionsSync($transactions); + ++$chunkCounter; + $categorizedFormatted = number_format($categorizedPercentage * 100, 1); + $line = '[' . $chunkCounter . '] Processed chunk. ' . $categorizedFormatted . '% categorized.'; + $this->line($line); + + } catch (Throwable $throwable) { + $this->error('[' . $chunkCounter . '] Processed chunk failed'); + $shortMessage = StringHelper::shortenAuto($throwable->getMessage(), 200); + $this->warn($shortMessage); } - ); + }); - /** - * @noinspection PhpUndefinedMethodInspection -*/ + /** @noinspection PhpUndefinedMethodInspection */ $categorizedTransactionsCount = Transaction::whereNotNull('category_id')->count(); $totalCategorizedPercentage = number_format( ($categorizedTransactionsCount / $transactionsTotalCount) * 100, diff --git a/app/Console/Commands/Transaction/CopyDecimalVolumeToCalculationVolume.php b/app/Console/Commands/Transaction/CopyDecimalVolumeToCalculationVolume.php index 2f5f5cb..436342e 100644 --- a/app/Console/Commands/Transaction/CopyDecimalVolumeToCalculationVolume.php +++ b/app/Console/Commands/Transaction/CopyDecimalVolumeToCalculationVolume.php @@ -14,16 +14,12 @@ class CopyDecimalVolumeToCalculationVolume extends Command public function handle(): void { - DB::transaction( - function () { - foreach (Transaction::cursor() as $transaction) { - $transaction->update( - [ - 'calculation_volume' => $transaction->decimal_volume - ] - ); - } + DB::transaction(function() { + foreach (Transaction::cursor() as $transaction) { + $transaction->update([ + 'calculation_volume' => $transaction->decimal_volume + ]); } - ); + }); } } diff --git a/app/Console/Commands/Transaction/CreateSettingsForUsers.php b/app/Console/Commands/Transaction/CreateSettingsForUsers.php index 58dc208..a3ecac5 100644 --- a/app/Console/Commands/Transaction/CreateSettingsForUsers.php +++ b/app/Console/Commands/Transaction/CreateSettingsForUsers.php @@ -17,16 +17,12 @@ public function handle(): int $this->info("Creating settings for existing users..."); foreach (User::cursor() as $user) { - /** - * @var User $user -*/ - Settings::firstOrCreate( - [ + /** @var User $user */ + Settings::firstOrCreate([ 'user_id' => $user->id - ], [ + ], [ 'base_currency_code' => config('moneypenny.base_calculation_currency') - ] - ); + ]); } $this->info('Success.'); diff --git a/app/Console/Commands/Transaction/SetAccountSaldoForUser.php b/app/Console/Commands/Transaction/SetAccountSaldoForUser.php index 3fe5877..662aea4 100644 --- a/app/Console/Commands/Transaction/SetAccountSaldoForUser.php +++ b/app/Console/Commands/Transaction/SetAccountSaldoForUser.php @@ -26,18 +26,14 @@ public function handle(): int $value = $this->ask('Type in value (eg. 3500.00): '); $floatValue = floatval($value); - $personalAccount = PersonalAccount::firstWhere( - [ + $personalAccount = PersonalAccount::firstWhere([ 'user_id' => $user->id, 'name' => 'Default' - ] - ); + ]); - $personalAccount = tap($personalAccount)->update( - [ + $personalAccount = tap($personalAccount)->update([ 'value' => $floatValue - ] - ); + ]); $this->info("Saldo value updated: " . $personalAccount->value . 'PLN'); diff --git a/app/Console/Commands/Transaction/ShowTransactionsPersonas.php b/app/Console/Commands/Transaction/ShowTransactionsPersonas.php index e78ac01..89dff1f 100644 --- a/app/Console/Commands/Transaction/ShowTransactionsPersonas.php +++ b/app/Console/Commands/Transaction/ShowTransactionsPersonas.php @@ -37,9 +37,7 @@ private function performTask(): array $transactionsPersonasData = []; foreach ($transactionsCursor as $transaction) { - /** - * @var Transaction $transaction -*/ + /** @var Transaction $transaction */ $spCommonName = $transaction->senderPersona?->common_name ?? ''; $rpCommonName = $transaction->receiverPersona?->common_name ?? ''; $sender = $transaction->sender ?? ''; diff --git a/app/Console/Commands/Transaction/UpdateTypesBasedOnRawVolume.php b/app/Console/Commands/Transaction/UpdateTypesBasedOnRawVolume.php index fb70f8a..0553bf6 100644 --- a/app/Console/Commands/Transaction/UpdateTypesBasedOnRawVolume.php +++ b/app/Console/Commands/Transaction/UpdateTypesBasedOnRawVolume.php @@ -13,17 +13,15 @@ class UpdateTypesBasedOnRawVolume extends Command public function handle(): void { - $this->withProgressBar( - Transaction::cursor(), function (Transaction $transaction) { - $rawVolume = $transaction->raw_volume; + $this->withProgressBar(Transaction::cursor(), function(Transaction $transaction) { + $rawVolume = $transaction->raw_volume; - if (str_starts_with($rawVolume, '-')) { - $transaction->update(['type' => Transaction::TYPE_EXPENDITURE]); - } else { - $transaction->update(['type' => Transaction::TYPE_INCOME]); - } + if (str_starts_with($rawVolume, '-')) { + $transaction->update(['type' => Transaction::TYPE_EXPENDITURE]); + } else { + $transaction->update(['type' => Transaction::TYPE_INCOME]); } - ); + }); $this->info(PHP_EOL . 'Transactions types updated successfully.'); } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index f0245e9..bbf1810 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -23,6 +23,6 @@ protected function commands(): void { $this->load(__DIR__.'/Commands'); - include base_path('routes/console.php'); + require base_path('routes/console.php'); } } diff --git a/app/Events/Notification/ApplicationNotificationSent.php b/app/Events/Notification/ApplicationNotificationSent.php index a5535b5..e56c4d8 100644 --- a/app/Events/Notification/ApplicationNotificationSent.php +++ b/app/Events/Notification/ApplicationNotificationSent.php @@ -16,7 +16,8 @@ public function __construct( public string $header, public string $message, public string $url - ) { + ) + { } public function broadcastAs(): string diff --git a/app/Events/Transaction/Category/ImportCategorizationFinished.php b/app/Events/Transaction/Category/ImportCategorizationFinished.php index 3980879..032e9c9 100644 --- a/app/Events/Transaction/Category/ImportCategorizationFinished.php +++ b/app/Events/Transaction/Category/ImportCategorizationFinished.php @@ -8,7 +8,5 @@ class ImportCategorizationFinished { use Dispatchable; - public function __construct(public mixed $importId) - { - } + public function __construct(public mixed $importId) {} } diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 8faa4c9..c597014 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -49,11 +49,9 @@ class Handler extends ExceptionHandler */ public function register(): void { - $this->reportable( - function (Throwable $e) { - // - } - ); + $this->reportable(function (Throwable $e) { + // + }); } /** @@ -76,12 +74,10 @@ protected function getJsonResponse(Throwable $throwable): JsonResponse { $statusCode = $this->getExceptionHTTPStatusCode($throwable); - return new JsonResponse( - [ + return new JsonResponse([ 'status' => $statusCode, 'message' => $throwable->getMessage() - ], $statusCode - ); + ], $statusCode); } protected function getExceptionHTTPStatusCode(Throwable $throwable): int diff --git a/app/Filters/Filter.php b/app/Filters/Filter.php index 23e29ef..82d77b1 100644 --- a/app/Filters/Filter.php +++ b/app/Filters/Filter.php @@ -51,9 +51,7 @@ public function applyOnQuery(Builder $builder): Builder return $builder; } - /** - * @var Filterable|Model $model -*/ + /** @var Filterable|Model $model */ $model = $builder->getModel(); $filterableColumns = $model::getFilterableColumns()->toArray(); diff --git a/app/Http/Controllers/Api/Auth/UserController.php b/app/Http/Controllers/Api/Auth/UserController.php index f5e52fb..c0a8194 100644 --- a/app/Http/Controllers/Api/Auth/UserController.php +++ b/app/Http/Controllers/Api/Auth/UserController.php @@ -33,11 +33,9 @@ public function login(LoginRequest $request): Response ); } catch (Throwable) { - return response( - [ + return response([ 'message' => 'Bad credential provided!', - ], 401 - ); + ], 401); } return response($result); @@ -47,20 +45,16 @@ public function logout(Request $request): Response { $this->userService->logout($request->user()); - return response( - [ + return response([ 'message' => 'User logged out successfully.', - ] - ); + ]); } public function user(Request $request): Response { - return response( - [ + return response([ 'user' => $request->user(), 'token' => $request->bearerToken(), - ] - ); + ]); } } diff --git a/app/Http/Controllers/Api/FileExplorer/FileExplorerController.php b/app/Http/Controllers/Api/FileExplorer/FileExplorerController.php index 7e158af..89c69ad 100644 --- a/app/Http/Controllers/Api/FileExplorer/FileExplorerController.php +++ b/app/Http/Controllers/Api/FileExplorer/FileExplorerController.php @@ -16,8 +16,7 @@ class FileExplorerController extends Controller public function __construct( private readonly FileRenderBuilder $fileRenderBuilder, private readonly DirectoryRenderBuilder $directoryRenderBuilder - ) { - } + ) {} public function get(Request $request): StreamedResponse { @@ -36,21 +35,17 @@ public function show(Request $request): JsonResponse ->build(); } catch (NotFoundHttpException $exception) { - return response()->json( - [ + return response()->json([ 'exists' => false, 'message' => $exception->getMessage(), - ], 404 - ); + ], 404); } - return response()->json( - [ + return response()->json([ 'exists' => true, 'file_type' => $fileRender->getFileType(), 'render' => $fileRender->getRenderedFile() - ] - ); + ]); } public function open(Request $request): JsonResponse @@ -62,11 +57,9 @@ public function open(Request $request): JsonResponse ->setTargetPath($targetPath) ->build(); - return response()->json( - [ + return response()->json([ 'requested_path' => $targetPath, 'render' => $directoryRender->getRenderedDirectory() - ] - ); + ]); } } diff --git a/app/Http/Controllers/Api/Notification/NotificationController.php b/app/Http/Controllers/Api/Notification/NotificationController.php index 88096b1..dd9d561 100644 --- a/app/Http/Controllers/Api/Notification/NotificationController.php +++ b/app/Http/Controllers/Api/Notification/NotificationController.php @@ -9,9 +9,7 @@ class NotificationController extends Controller { - public function __construct(private readonly NotificationService $notificationService) - { - } + public function __construct(private readonly NotificationService $notificationService) {} public function index(Request $request): JsonResponse { @@ -19,10 +17,8 @@ public function index(Request $request): JsonResponse $limit = $request->integer('limit', 5); $notifications = $this->notificationService->all($user, $limit); - return response()->json( - [ + return response()->json([ 'notifications' => $notifications - ] - ); + ]); } } diff --git a/app/Http/Controllers/Api/Profile/ProfileController.php b/app/Http/Controllers/Api/Profile/ProfileController.php index 0241a51..39c6e94 100644 --- a/app/Http/Controllers/Api/Profile/ProfileController.php +++ b/app/Http/Controllers/Api/Profile/ProfileController.php @@ -9,9 +9,7 @@ class ProfileController extends Controller { - public function __construct(private readonly ProfileFileService $profileFileService) - { - } + public function __construct(private readonly ProfileFileService $profileFileService) {} public function selectLibraryAvatar(Request $request): JsonResponse { diff --git a/app/Http/Controllers/Api/Synchronization/SynchronizationController.php b/app/Http/Controllers/Api/Synchronization/SynchronizationController.php index 38b90d2..5362158 100644 --- a/app/Http/Controllers/Api/Synchronization/SynchronizationController.php +++ b/app/Http/Controllers/Api/Synchronization/SynchronizationController.php @@ -17,7 +17,8 @@ public function __construct( private readonly NordigenAccountService $nordigenAccountService, private readonly SynchronizationService $synchronizationService, private readonly TransactionSyncServiceInterface $transactionSyncService - ) { + ) + { } public function sync(Request $request): JsonResponse @@ -40,13 +41,11 @@ public function sync(Request $request): JsonResponse $supportedStatuses = [500, 429, 408]; $statusCode = in_array($throwable->getCode(), $supportedStatuses) ? $statusCode : 500; - return response()->json( - [ + return response()->json([ 'error' => 'Synchronization error', 'details' => App::hasDebugModeEnabled() ? $throwable->getMessage() : 'Lacking permissions', 'status_code' => $statusCode, - ], $statusCode - ); + ], $statusCode); } $accounts = $this->nordigenAccountService->all($user); diff --git a/app/Http/Controllers/Api/Transaction/Analytics/AnalyticsController.php b/app/Http/Controllers/Api/Transaction/Analytics/AnalyticsController.php index 97cd4f5..621546a 100644 --- a/app/Http/Controllers/Api/Transaction/Analytics/AnalyticsController.php +++ b/app/Http/Controllers/Api/Transaction/Analytics/AnalyticsController.php @@ -8,9 +8,7 @@ class AnalyticsController extends Controller { - public function __construct(private readonly AnalyticsService $analyticsService) - { - } + public function __construct(private readonly AnalyticsService $analyticsService) {} public function index(Request $request): array { diff --git a/app/Http/Controllers/Api/Transaction/ReportController.php b/app/Http/Controllers/Api/Transaction/ReportController.php index e1c7388..2d5d5b2 100644 --- a/app/Http/Controllers/Api/Transaction/ReportController.php +++ b/app/Http/Controllers/Api/Transaction/ReportController.php @@ -9,9 +9,7 @@ class ReportController extends Controller { - public function __construct(private readonly ReportService $reportService) - { - } + public function __construct(private readonly ReportService $reportService) {} public function avgExpenditures(Request $request): JsonResponse { @@ -20,11 +18,9 @@ public function avgExpenditures(Request $request): JsonResponse ->reportService ->getAvgExpendituresByDays($user, sinceDate: now()->subMonth(), toDate: now()); - return response()->json( - [ + return response()->json([ 'dataset' => $data - ] - ); + ]); } public function avgIncomes(Request $request): JsonResponse @@ -34,10 +30,8 @@ public function avgIncomes(Request $request): JsonResponse ->reportService ->getAvgIncomesByDays($user, sinceDate: now()->subMonth(), toDate: now()); - return response()->json( - [ + return response()->json([ 'dataset' => $data - ] - ); + ]); } } diff --git a/app/Http/Controllers/Web/Auth/ConfirmablePasswordController.php b/app/Http/Controllers/Web/Auth/ConfirmablePasswordController.php index 38d658e..12ee2f4 100644 --- a/app/Http/Controllers/Web/Auth/ConfirmablePasswordController.php +++ b/app/Http/Controllers/Web/Auth/ConfirmablePasswordController.php @@ -25,18 +25,13 @@ public function show(): View */ public function store(Request $request): RedirectResponse { - if (! Auth::guard('web')->validate( - [ + if (! Auth::guard('web')->validate([ 'email' => $request->user()->email, 'password' => $request->password, - ] - ) - ) { - throw ValidationException::withMessages( - [ + ])) { + throw ValidationException::withMessages([ 'password' => __('auth.password'), - ] - ); + ]); } $request->session()->put('auth.password_confirmed_at', time()); diff --git a/app/Http/Controllers/Web/Auth/DeviceController.php b/app/Http/Controllers/Web/Auth/DeviceController.php index 8a01e20..5c2053e 100644 --- a/app/Http/Controllers/Web/Auth/DeviceController.php +++ b/app/Http/Controllers/Web/Auth/DeviceController.php @@ -9,9 +9,7 @@ class DeviceController extends Controller { - public function __construct(private readonly DeviceService $deviceService) - { - } + public function __construct(private readonly DeviceService $deviceService) {} public function index(Request $request): View { diff --git a/app/Http/Controllers/Web/Auth/NewPasswordController.php b/app/Http/Controllers/Web/Auth/NewPasswordController.php index 765fa93..ce66f09 100644 --- a/app/Http/Controllers/Web/Auth/NewPasswordController.php +++ b/app/Http/Controllers/Web/Auth/NewPasswordController.php @@ -29,13 +29,11 @@ public function create(Request $request): View */ public function store(Request $request): RedirectResponse { - $request->validate( - [ + $request->validate([ 'token' => ['required'], 'email' => ['required', 'email'], 'password' => ['required', 'confirmed', Rules\Password::defaults()], - ] - ); + ]); // Here we will attempt to reset the user's password. If it is successful we // will update the password on an actual user model and persist it to the @@ -43,12 +41,10 @@ public function store(Request $request): RedirectResponse $status = Password::reset( $request->only('email', 'password', 'password_confirmation', 'token'), function ($user) use ($request) { - $user->forceFill( - [ + $user->forceFill([ 'password' => Hash::make($request->password), 'remember_token' => Str::random(60), - ] - )->save(); + ])->save(); event(new PasswordReset($user)); } @@ -60,6 +56,6 @@ function ($user) use ($request) { return $status == Password::PASSWORD_RESET ? redirect()->route('login')->with('status', __($status)) : back()->withInput($request->only('email')) - ->withErrors(['email' => __($status)]); + ->withErrors(['email' => __($status)]); } } diff --git a/app/Http/Controllers/Web/Auth/PasswordController.php b/app/Http/Controllers/Web/Auth/PasswordController.php index 1ea6cc3..4fcca3d 100644 --- a/app/Http/Controllers/Web/Auth/PasswordController.php +++ b/app/Http/Controllers/Web/Auth/PasswordController.php @@ -15,18 +15,14 @@ class PasswordController extends Controller */ public function update(Request $request): RedirectResponse { - $validated = $request->validateWithBag( - 'updatePassword', [ + $validated = $request->validateWithBag('updatePassword', [ 'current_password' => ['required', 'current_password'], 'password' => ['required', Password::defaults(), 'confirmed'], - ] - ); + ]); - $request->user()->update( - [ + $request->user()->update([ 'password' => Hash::make($validated['password']), - ] - ); + ]); return back()->with('status', 'password-updated'); } diff --git a/app/Http/Controllers/Web/Auth/PasswordResetLinkController.php b/app/Http/Controllers/Web/Auth/PasswordResetLinkController.php index 1820e01..43376d3 100644 --- a/app/Http/Controllers/Web/Auth/PasswordResetLinkController.php +++ b/app/Http/Controllers/Web/Auth/PasswordResetLinkController.php @@ -25,11 +25,9 @@ public function create(): View */ public function store(Request $request): RedirectResponse { - $request->validate( - [ + $request->validate([ 'email' => ['required', 'email'], - ] - ); + ]); // We will send the password reset link to this user. Once we have attempted // to send the link, we will examine the response then see the message we @@ -41,6 +39,6 @@ public function store(Request $request): RedirectResponse return $status == Password::RESET_LINK_SENT ? back()->with('status', __($status)) : back()->withInput($request->only('email')) - ->withErrors(['email' => __($status)]); + ->withErrors(['email' => __($status)]); } } diff --git a/app/Http/Controllers/Web/Auth/ProfileController.php b/app/Http/Controllers/Web/Auth/ProfileController.php index a16658f..fe3fffe 100644 --- a/app/Http/Controllers/Web/Auth/ProfileController.php +++ b/app/Http/Controllers/Web/Auth/ProfileController.php @@ -17,11 +17,9 @@ class ProfileController extends Controller */ public function edit(Request $request): View { - return view( - 'profile.edit', [ + return view('profile.edit', [ 'user' => $request->user(), - ] - ); + ]); } /** @@ -45,11 +43,9 @@ public function update(UpdateRequest $request): RedirectResponse */ public function destroy(Request $request): RedirectResponse { - $request->validateWithBag( - 'userDeletion', [ + $request->validateWithBag('userDeletion', [ 'password' => ['required', 'current_password'], - ] - ); + ]); $user = $request->user(); diff --git a/app/Http/Controllers/Web/Auth/RegisteredUserController.php b/app/Http/Controllers/Web/Auth/RegisteredUserController.php index b26e2fe..89f4b80 100644 --- a/app/Http/Controllers/Web/Auth/RegisteredUserController.php +++ b/app/Http/Controllers/Web/Auth/RegisteredUserController.php @@ -30,21 +30,17 @@ public function create(): View */ public function store(Request $request): RedirectResponse { - $request->validate( - [ + $request->validate([ 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:'.User::class], 'password' => ['required', 'confirmed', Rules\Password::defaults()], - ] - ); + ]); - $user = User::create( - [ + $user = User::create([ 'name' => $request->name, 'email' => $request->email, 'password' => Hash::make($request->password), - ] - ); + ]); event(new Registered($user)); diff --git a/app/Http/Controllers/Web/Auth/SetupController.php b/app/Http/Controllers/Web/Auth/SetupController.php index fd7115b..0ac8169 100644 --- a/app/Http/Controllers/Web/Auth/SetupController.php +++ b/app/Http/Controllers/Web/Auth/SetupController.php @@ -9,19 +9,15 @@ class SetupController extends Controller { - public function __construct(private readonly UserService $userService) - { - } + public function __construct(private readonly UserService $userService) {} public function setup(Request $request): View { $apiToken = $this->userService->getOrCreateApiToken($request->user()); - return view( - 'auth.setup', [ + return view('auth.setup', [ 'redirect' => route('setting.edit'), 'currentApiToken' => $apiToken - ] - ); + ]); } } diff --git a/app/Http/Controllers/Web/ExchangeRates/ExchangeRateController.php b/app/Http/Controllers/Web/ExchangeRates/ExchangeRateController.php index bd215b9..babca75 100644 --- a/app/Http/Controllers/Web/ExchangeRates/ExchangeRateController.php +++ b/app/Http/Controllers/Web/ExchangeRates/ExchangeRateController.php @@ -8,9 +8,7 @@ class ExchangeRateController extends Controller { - public function __construct(private readonly ExchangeRatesService $exchangeRatesService) - { - } + public function __construct(private readonly ExchangeRatesService $exchangeRatesService) {} public function index(): View { diff --git a/app/Http/Controllers/Web/File/FileController.php b/app/Http/Controllers/Web/File/FileController.php index e26f651..d01d921 100644 --- a/app/Http/Controllers/Web/File/FileController.php +++ b/app/Http/Controllers/Web/File/FileController.php @@ -20,7 +20,8 @@ public function __construct( private readonly FileUploadService $fileUploadService, private readonly ColumnMappingService $columnMappingService, private readonly ImportSettingService $importSettingService - ) { + ) + { } public function index(Request $request): View @@ -35,11 +36,9 @@ public function index(Request $request): View public function show(mixed $id, Request $request): View { - return view( - 'file.show', [ + return view('file.show', [ 'file' => $this->fileService->findOrFail($id, $request->user()), - ] - ); + ]); } /** diff --git a/app/Http/Controllers/Web/Import/ImportController.php b/app/Http/Controllers/Web/Import/ImportController.php index 1456aa5..a9e9ff1 100644 --- a/app/Http/Controllers/Web/Import/ImportController.php +++ b/app/Http/Controllers/Web/Import/ImportController.php @@ -9,9 +9,7 @@ class ImportController extends Controller { - public function __construct(private readonly ImportService $importService) - { - } + public function __construct(private readonly ImportService $importService) {} public function index(Request $request): View { diff --git a/app/Http/Controllers/Web/Import/ImportSettingController.php b/app/Http/Controllers/Web/Import/ImportSettingController.php index b27d463..97f28b4 100644 --- a/app/Http/Controllers/Web/Import/ImportSettingController.php +++ b/app/Http/Controllers/Web/Import/ImportSettingController.php @@ -17,8 +17,7 @@ class ImportSettingController extends Controller public function __construct( private readonly ImportService $importService, private readonly ImportSettingService $importSettingService - ) { - } + ) {} public function index(Request $request): View { diff --git a/app/Http/Controllers/Web/Nordigen/Institution/InstitutionController.php b/app/Http/Controllers/Web/Nordigen/Institution/InstitutionController.php index 696017e..842f387 100644 --- a/app/Http/Controllers/Web/Nordigen/Institution/InstitutionController.php +++ b/app/Http/Controllers/Web/Nordigen/Institution/InstitutionController.php @@ -26,11 +26,9 @@ public function index(Request $request): View|RedirectResponse } catch (Throwable) { return back() - ->with( - config('session.flash_errors_key'), [ + ->with(config('session.flash_errors_key'), [ __('Cannot fetch institutions data.') - ] - ); + ]); } } diff --git a/app/Http/Controllers/Web/Notification/NotificationController.php b/app/Http/Controllers/Web/Notification/NotificationController.php index a6860b4..1293250 100644 --- a/app/Http/Controllers/Web/Notification/NotificationController.php +++ b/app/Http/Controllers/Web/Notification/NotificationController.php @@ -17,8 +17,7 @@ class NotificationController extends Controller public function __construct( private readonly NotificationService $notificationService, private readonly NotificationBroadcastService $notificationBroadcastService - ) { - } + ) {} public function index(Request $request): View { diff --git a/app/Http/Controllers/Web/Social/ChatController.php b/app/Http/Controllers/Web/Social/ChatController.php index 7c5fcec..e1c94d7 100644 --- a/app/Http/Controllers/Web/Social/ChatController.php +++ b/app/Http/Controllers/Web/Social/ChatController.php @@ -16,8 +16,7 @@ class ChatController extends Controller public function __construct( private readonly CacheAdapterInterface $cacheAdapter, private readonly NotificationBroadcastService $notificationBroadcastService - ) { - } + ) {} public function index(): View { diff --git a/app/Http/Controllers/Web/Synchronization/SynchronizationController.php b/app/Http/Controllers/Web/Synchronization/SynchronizationController.php index ec4ea7f..69a2a82 100644 --- a/app/Http/Controllers/Web/Synchronization/SynchronizationController.php +++ b/app/Http/Controllers/Web/Synchronization/SynchronizationController.php @@ -9,9 +9,7 @@ class SynchronizationController extends Controller { - public function __construct(private readonly SynchronizationService $synchronizationService) - { - } + public function __construct(private readonly SynchronizationService $synchronizationService) {} public function index(Request $request): View { diff --git a/app/Http/Controllers/Web/Transaction/BudgetController.php b/app/Http/Controllers/Web/Transaction/BudgetController.php index b440427..7193910 100644 --- a/app/Http/Controllers/Web/Transaction/BudgetController.php +++ b/app/Http/Controllers/Web/Transaction/BudgetController.php @@ -16,8 +16,7 @@ class BudgetController extends Controller public function __construct( private readonly BudgetService $budgetService, private readonly CurrencyService $currencyService - ) { - } + ) {} public function index(Request $request): View { diff --git a/app/Http/Controllers/Web/Transaction/Categorize/CategorizationController.php b/app/Http/Controllers/Web/Transaction/Categorize/CategorizationController.php index 97e3c39..bf947d8 100644 --- a/app/Http/Controllers/Web/Transaction/Categorize/CategorizationController.php +++ b/app/Http/Controllers/Web/Transaction/Categorize/CategorizationController.php @@ -14,8 +14,7 @@ class CategorizationController extends Controller public function __construct( private readonly CacheAdapterInterface $cacheAdapter, private readonly CategorizationService $categorizationService - ) { - } + ) {} public function index(): View { diff --git a/app/Http/Controllers/Web/Transaction/CategoryController.php b/app/Http/Controllers/Web/Transaction/CategoryController.php index f9fa5f6..0ef7942 100644 --- a/app/Http/Controllers/Web/Transaction/CategoryController.php +++ b/app/Http/Controllers/Web/Transaction/CategoryController.php @@ -17,7 +17,7 @@ public function index(Request $request): View if (!$user->is_admin) { $baseQuery = Category::whereHas( 'transactions', fn($relation) => $relation - ->where('user_id', $user->id) + ->where('user_id', $user->id) ); } diff --git a/app/Http/Controllers/Web/Transaction/PersonaController.php b/app/Http/Controllers/Web/Transaction/PersonaController.php index 884bfe2..cc4cb51 100644 --- a/app/Http/Controllers/Web/Transaction/PersonaController.php +++ b/app/Http/Controllers/Web/Transaction/PersonaController.php @@ -12,9 +12,7 @@ class PersonaController extends Controller { - public function __construct(private readonly TransactionPersonaService $transactionPersonaService) - { - } + public function __construct(private readonly TransactionPersonaService $transactionPersonaService) {} public function index(Request $request): View { @@ -26,22 +24,18 @@ public function index(Request $request): View ->get(); if (null !== $selectedPersonaId) { - return view( - 'persona.index', [ + return view('persona.index', [ 'personas' => $personas, 'selected_persona' => Persona::with( 'transactionsAsSender', 'transactionsAsReceiver' ) ->find($selectedPersonaId) - ] - ); + ]); } - return view( - 'persona.index', [ + return view('persona.index', [ 'personas' => $personas, - ] - ); + ]); } public function update(Persona $persona, Request $request): RedirectResponse diff --git a/app/Http/Controllers/Web/Transaction/PersonalAccountController.php b/app/Http/Controllers/Web/Transaction/PersonalAccountController.php index 0b13471..1b39c9e 100644 --- a/app/Http/Controllers/Web/Transaction/PersonalAccountController.php +++ b/app/Http/Controllers/Web/Transaction/PersonalAccountController.php @@ -17,11 +17,9 @@ public function index(Request $request): View ->withCount('transactions') ->get(); - return view( - 'personal_account.index', [ + return view('personal_account.index', [ 'personalAccounts' => $personalAccounts - ] - ); + ]); } public function edit(Request $request): View @@ -29,27 +27,21 @@ public function edit(Request $request): View // @todo - handle editing multiplte personal account saldos $personalAccount = $request->user()->personalAccounts()->first(); - return view( - 'personal_account.edit', [ + return view('personal_account.edit', [ 'personalAccount' => $personalAccount - ] - ); + ]); } public function update(Request $request): RedirectResponse { // @todo - handle editing multiplte personal account saldos $personalAccount = $request->user()->personalAccounts()->first(); - $request->validate( - [ + $request->validate([ 'value' => 'numeric|gte:0' - ] - ); - $personalAccount->update( - [ + ]); + $personalAccount->update([ 'value' => $request->input('value') - ] - ); + ]); return to_route('home'); } diff --git a/app/Http/Controllers/Web/Transaction/ReportController.php b/app/Http/Controllers/Web/Transaction/ReportController.php index 1d4da7b..58051dd 100644 --- a/app/Http/Controllers/Web/Transaction/ReportController.php +++ b/app/Http/Controllers/Web/Transaction/ReportController.php @@ -9,9 +9,7 @@ class ReportController extends Controller { - public function __construct(private readonly ReportService $reportService) - { - } + public function __construct(private readonly ReportService $reportService) {} public function periodic(Request $request): View { diff --git a/app/Http/Controllers/Web/Transaction/SettingsController.php b/app/Http/Controllers/Web/Transaction/SettingsController.php index a25991e..18cb384 100644 --- a/app/Http/Controllers/Web/Transaction/SettingsController.php +++ b/app/Http/Controllers/Web/Transaction/SettingsController.php @@ -12,9 +12,7 @@ class SettingsController extends Controller { - public function __construct(private readonly NotificationBroadcastService $notificationBroadcastService) - { - } + public function __construct(private readonly NotificationBroadcastService $notificationBroadcastService) {} public function edit(Request $request): View { @@ -31,12 +29,10 @@ public function update(EditRequest $request): RedirectResponse $data = $request->validated(); $user = $request->user(); - Settings::firstOrCreate( - [ + Settings::firstOrCreate([ 'user_id' => $user->id, 'base_currency_code' => $data['base_currency_code'] - ] - ); + ]); $this->notificationBroadcastService->sendStoredApplicationNotification( header: 'Settings saved', diff --git a/app/Http/Controllers/Web/Transaction/TransactionController.php b/app/Http/Controllers/Web/Transaction/TransactionController.php index 46721f7..aacf919 100644 --- a/app/Http/Controllers/Web/Transaction/TransactionController.php +++ b/app/Http/Controllers/Web/Transaction/TransactionController.php @@ -18,8 +18,7 @@ class TransactionController extends Controller public function __construct( private readonly TransactionService $transactionService, private readonly CurrencyService $currencyService - ) { - } + ) {} public function index(Request $request): View { @@ -50,12 +49,10 @@ public function create(CreateRequest $request): RedirectResponse $this->transactionService->create($user, $data); return to_route('transaction.index') - ->with( - config('session.flash_messages_key'), [ + ->with(config('session.flash_messages_key'), [ __('Added new transaction.') - ] - ); - } + ]); + } public function patch(mixed $transactionId, PatchRequest $request): RedirectResponse { @@ -72,10 +69,8 @@ public function toggleExcludeFromCalculation(mixed $transactionId): RedirectResp $this->transactionService->toggleExcludeFromCalculation($transactionId); return to_route('transaction.show', ['id' => $transaction->id]) - ->with( - config('session.flash_messages_key'), [ + ->with(config('session.flash_messages_key'), [ __('Changed transaction calculation settings.') - ] - ); + ]); } } diff --git a/app/Http/Controllers/Web/User/UserController.php b/app/Http/Controllers/Web/User/UserController.php index ed7c7e1..509d4bd 100644 --- a/app/Http/Controllers/Web/User/UserController.php +++ b/app/Http/Controllers/Web/User/UserController.php @@ -51,8 +51,7 @@ public function show(mixed $id): View $baseCurrencyCode = Settings::whereUser($user)?->get()->first()?->base_currency_code ?? 'No data'; $devices = $this->deviceService->all($user); - return view( - 'admin.users.show', [ + return view('admin.users.show', [ 'user' => $user, 'devices' => $devices, 'baseCurrencyCode' => $baseCurrencyCode, @@ -64,8 +63,7 @@ public function show(mixed $id): View 'requisitionsCount' => $requisitionsCount, 'nordigenAccountsCount' => $nordigenAccountsCount, 'synchronizationsCount' => $synchronizationsCount - ] - ); + ]); } public function confirmRoleChange(mixed $id): View diff --git a/app/Http/Middleware/CheckOneTimeRegistrationToken.php b/app/Http/Middleware/CheckOneTimeRegistrationToken.php index 2a90d17..07bb502 100644 --- a/app/Http/Middleware/CheckOneTimeRegistrationToken.php +++ b/app/Http/Middleware/CheckOneTimeRegistrationToken.php @@ -9,9 +9,7 @@ class CheckOneTimeRegistrationToken { - public function __construct(private readonly TokenRegistrationService $tokenRegistrationService) - { - } + public function __construct(private readonly TokenRegistrationService $tokenRegistrationService) {} public function handle(Request $request, Closure $next): Response { diff --git a/app/Http/Middleware/DenyAccessForBlockedUsers.php b/app/Http/Middleware/DenyAccessForBlockedUsers.php index d57f37f..2debf3b 100644 --- a/app/Http/Middleware/DenyAccessForBlockedUsers.php +++ b/app/Http/Middleware/DenyAccessForBlockedUsers.php @@ -12,11 +12,9 @@ public function handle(Request $request, Closure $next): Response { if ($request->user()?->isBlocked()) { if ($request->wantsJson()) { - return response()->json( - [ + return response()->json([ 'error' => 'Your account has been blocked by the system administration.' - ], 403 - ); + ], 403); } return to_route('blocked.index'); diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index dae8398..afc78c4 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -13,7 +13,7 @@ class RedirectIfAuthenticated /** * Handle an incoming request. * - * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next + * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next */ public function handle(Request $request, Closure $next, string ...$guards): Response { diff --git a/app/Http/Requests/Web/Admin/Notifications/SendRequest.php b/app/Http/Requests/Web/Admin/Notifications/SendRequest.php index ea1479f..eb6970d 100644 --- a/app/Http/Requests/Web/Admin/Notifications/SendRequest.php +++ b/app/Http/Requests/Web/Admin/Notifications/SendRequest.php @@ -17,15 +17,13 @@ public function rules(): array 'user_id' => 'nullable|exists:users,id', 'type' => [ 'nullable', - Rule::in( - [ + Rule::in([ Notification::TYPE_INFO, Notification::TYPE_ERROR, Notification::TYPE_EVENT, Notification::TYPE_SUCCESS, Notification::TYPE_WARNING - ] - ) + ]) ] ]; } diff --git a/app/Http/Requests/Web/Auth/LoginRequest.php b/app/Http/Requests/Web/Auth/LoginRequest.php index 7eeb71a..631ee56 100644 --- a/app/Http/Requests/Web/Auth/LoginRequest.php +++ b/app/Http/Requests/Web/Auth/LoginRequest.php @@ -44,11 +44,9 @@ public function authenticate(): void if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) { RateLimiter::hit($this->throttleKey()); - throw ValidationException::withMessages( - [ + throw ValidationException::withMessages([ 'email' => trans('auth.failed'), - ] - ); + ]); } RateLimiter::clear($this->throttleKey()); @@ -69,16 +67,12 @@ public function ensureIsNotRateLimited(): void $seconds = RateLimiter::availableIn($this->throttleKey()); - throw ValidationException::withMessages( - [ - 'email' => trans( - 'auth.throttle', [ + throw ValidationException::withMessages([ + 'email' => trans('auth.throttle', [ 'seconds' => $seconds, 'minutes' => ceil($seconds / 60), - ] - ), - ] - ); + ]), + ]); } /** diff --git a/app/Http/Requests/Web/Transaction/Budget/PatchRequest.php b/app/Http/Requests/Web/Transaction/Budget/PatchRequest.php index 70a2bf9..13e94a3 100644 --- a/app/Http/Requests/Web/Transaction/Budget/PatchRequest.php +++ b/app/Http/Requests/Web/Transaction/Budget/PatchRequest.php @@ -17,13 +17,11 @@ public function rules(): array 'name' => 'string', 'amount' => 'numeric|gte:0', 'type' => [ - Rule::in( - [ + Rule::in([ Budget::TYPE_MONTH, Budget::TYPE_WEEK, Budget::TYPE_DAY - ] - ) + ]) ] ]; } diff --git a/app/Http/Traits/HasJsonFailedValidationResponse.php b/app/Http/Traits/HasJsonFailedValidationResponse.php index cc03eaf..83bd84e 100644 --- a/app/Http/Traits/HasJsonFailedValidationResponse.php +++ b/app/Http/Traits/HasJsonFailedValidationResponse.php @@ -17,12 +17,10 @@ protected function failedValidation(Validator $validator) $errors = (new ValidationException($validator))->errors(); throw new HttpResponseException( - response()->json( - [ + response()->json([ 'errors' => $errors, 'message' => 'validation.failed' - ], Response::HTTP_UNPROCESSABLE_ENTITY - ) + ], Response::HTTP_UNPROCESSABLE_ENTITY) ); } } diff --git a/app/Imports/TransactionsImport.php b/app/Imports/TransactionsImport.php index c1fb4ba..d9f4093 100644 --- a/app/Imports/TransactionsImport.php +++ b/app/Imports/TransactionsImport.php @@ -20,11 +20,12 @@ public function __construct( private readonly ColumnsMapping $columnsMapping, private readonly Import $import, private readonly User $user - ) { + ) + { } /** - * @param Collection $collection + * @param Collection $collection * @throws Throwable */ public function collection(Collection $collection): void @@ -33,9 +34,7 @@ public function collection(Collection $collection): void try { foreach ($collection as $row) { - /** - * @var TransactionImportService $service -*/ + /** @var TransactionImportService $service */ $service = app(TransactionImportService::class); $service->importFileRowAsTransaction($row, $this->import, $this->columnsMapping, $this->user); diff --git a/app/Jobs/Auth/CreateUserSettings.php b/app/Jobs/Auth/CreateUserSettings.php index 27753c6..7567d7a 100644 --- a/app/Jobs/Auth/CreateUserSettings.php +++ b/app/Jobs/Auth/CreateUserSettings.php @@ -14,9 +14,7 @@ class CreateUserSettings implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(public User $user) - { - } + public function __construct(public User $user) {} public function handle(UserSettingsService $userSettingsService): void { diff --git a/app/Jobs/Transaction/CategorizeTransactions.php b/app/Jobs/Transaction/CategorizeTransactions.php index 95426c4..29f81e6 100644 --- a/app/Jobs/Transaction/CategorizeTransactions.php +++ b/app/Jobs/Transaction/CategorizeTransactions.php @@ -22,8 +22,7 @@ public function __construct(public array $transactionsIds) /** * Execute the job. - * - * @throws Exception + * @throws Exception * @noinspection PhpUndefinedMethodInspection */ public function handle(TransactionCategorizeService $transactionCategorizeService): void diff --git a/app/Jobs/Transaction/RecategorizeAllTransactions.php b/app/Jobs/Transaction/RecategorizeAllTransactions.php index c3e2216..57eef93 100644 --- a/app/Jobs/Transaction/RecategorizeAllTransactions.php +++ b/app/Jobs/Transaction/RecategorizeAllTransactions.php @@ -14,9 +14,7 @@ class RecategorizeAllTransactions implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, Batchable; - public function __construct() - { - } + public function __construct() {} public function handle(): void { diff --git a/app/Jobs/Transaction/ResolveTransactionCalculationVolume.php b/app/Jobs/Transaction/ResolveTransactionCalculationVolume.php index 451b1d1..dea4df1 100644 --- a/app/Jobs/Transaction/ResolveTransactionCalculationVolume.php +++ b/app/Jobs/Transaction/ResolveTransactionCalculationVolume.php @@ -20,9 +20,7 @@ class ResolveTransactionCalculationVolume implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(public mixed $transactionId) - { - } + public function __construct(public mixed $transactionId) {} /** * @throws GuzzleException @@ -46,11 +44,9 @@ public function handle(CurrencyService $currencyService, ExchangeRatesService $e $oldCalculationVolume = $transaction->calculation_volume; - $transaction->update( - [ + $transaction->update([ 'calculation_volume' => $oldCalculationVolume * (float) $exchangeRate->rate - ] - ); + ]); } catch (Throwable $throwable) { Log::error($throwable); diff --git a/app/Jobs/Transaction/SaveTransactionCategoryReference.php b/app/Jobs/Transaction/SaveTransactionCategoryReference.php index 5bb3e62..d3e15fc 100644 --- a/app/Jobs/Transaction/SaveTransactionCategoryReference.php +++ b/app/Jobs/Transaction/SaveTransactionCategoryReference.php @@ -14,9 +14,7 @@ class SaveTransactionCategoryReference implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(public mixed $transactionId) - { - } + public function __construct(public mixed $transactionId) {} public function handle(CategoryReferenceService $categoryReferenceService): void { diff --git a/app/Jobs/Transaction/UpdateUsersPersonalAccountSaldo.php b/app/Jobs/Transaction/UpdateUsersPersonalAccountSaldo.php index b41bb8c..fa5b874 100644 --- a/app/Jobs/Transaction/UpdateUsersPersonalAccountSaldo.php +++ b/app/Jobs/Transaction/UpdateUsersPersonalAccountSaldo.php @@ -14,9 +14,7 @@ class UpdateUsersPersonalAccountSaldo implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(public mixed $transactionId) - { - } + public function __construct(public mixed $transactionId) {} public function handle(SaldoService $saldoService): void { $transaction = Transaction::findOrFail($this->transactionId); diff --git a/app/Listeners/Auth/HandleWhenDeviceHijacked.php b/app/Listeners/Auth/HandleWhenDeviceHijacked.php index 66314c1..6770e4b 100644 --- a/app/Listeners/Auth/HandleWhenDeviceHijacked.php +++ b/app/Listeners/Auth/HandleWhenDeviceHijacked.php @@ -7,15 +7,11 @@ readonly class HandleWhenDeviceHijacked { - public function __construct(private DeviceService $deviceService) - { - } + public function __construct(private DeviceService $deviceService) {} public function handle(object $event): void { - /** - * @var DeviceHijacked $event -*/ + /** @var DeviceHijacked $event */ $this->deviceService->handleWhenDeviceHijacked($event); } } diff --git a/app/Mixins/AssertableJsonMixin.php b/app/Mixins/AssertableJsonMixin.php index d9cc844..9570593 100644 --- a/app/Mixins/AssertableJsonMixin.php +++ b/app/Mixins/AssertableJsonMixin.php @@ -10,9 +10,7 @@ class AssertableJsonMixin public function hasValidPagination(): Closure { return function (): AssertableJson { - /** - * @var AssertableJson $this -*/ + /** @var AssertableJson $this */ return $this ->whereType('data', 'array') ->whereType('current_page', 'integer') diff --git a/app/Mixins/FactoryMixin.php b/app/Mixins/FactoryMixin.php index 0d509ba..c58e4d9 100644 --- a/app/Mixins/FactoryMixin.php +++ b/app/Mixins/FactoryMixin.php @@ -11,15 +11,11 @@ */ class FactoryMixin { - /** - * @noinspection PhpUndefinedMethodInspection - */ + /** @noinspection PhpUndefinedMethodInspection */ public function firstOrCreate(): Closure { return function (): Model { - /** - * @var Factory $this -*/ + /** @var Factory $this */ return $this->modelName()::first() ?? $this->modelName()::factory()->create(); }; } diff --git a/app/Mixins/RouteMixin.php b/app/Mixins/RouteMixin.php index ed5741a..fe55ade 100644 --- a/app/Mixins/RouteMixin.php +++ b/app/Mixins/RouteMixin.php @@ -17,19 +17,12 @@ public function crud(): Closure ?string $update = null, ?string $delete = null ) { - /** - * @var Route $this -*/ - if ($index) { $this->get('/', [$index, 'index']); - } - if ($show) { $this->get('/{id}', [$show, 'show']); - } - if ($create) { $this->post('/', [$create, 'create']); - } - if ($update) { $this->put('/{id}', [$update, 'update']); - } - if ($delete) { $this->delete('/{id}', [$delete, 'delete']); - } + /** @var Route $this */ + if ($index) $this->get('/', [$index, 'index']); + if ($show) $this->get('/{id}', [$show, 'show']); + if ($create) $this->post('/', [$create, 'create']); + if ($update) $this->put('/{id}', [$update, 'update']); + if ($delete) $this->delete('/{id}', [$delete, 'delete']); return $this; }; diff --git a/app/Models/Auth/Settings.php b/app/Models/Auth/Settings.php index dae01db..755081e 100644 --- a/app/Models/Auth/Settings.php +++ b/app/Models/Auth/Settings.php @@ -9,7 +9,7 @@ /** * @property string $base_currency_code * @property mixed $user_id - * @method static whereUser($user) + * @method static whereUser($user) */ class Settings extends Model { diff --git a/app/Models/ExchangeRates/ExchangeRate.php b/app/Models/ExchangeRates/ExchangeRate.php index d0ca759..1fd0b8b 100644 --- a/app/Models/ExchangeRates/ExchangeRate.php +++ b/app/Models/ExchangeRates/ExchangeRate.php @@ -6,10 +6,10 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; /** - * @method static where(string[] $criteria) - * @method static whereDate(string $string, string $format) - * @method static create(array $array) - * @method static latest() + * @method static where(string[] $criteria) + * @method static whereDate(string $string, string $format) + * @method static create(array $array) + * @method static latest() * @property string $rate */ class ExchangeRate extends Model diff --git a/app/Models/File.php b/app/Models/File.php index c8e0511..4e772d4 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -13,9 +13,9 @@ * @property int $import_setting_id * @property int $id * @property mixed $user_id - * @method static findOrFail(int $fileId) - * @method static latest() - * @method static whereUser(User $user) + * @method static findOrFail(int $fileId) + * @method static latest() + * @method static whereUser(User $user) */ class File extends Model { diff --git a/app/Models/Import/ColumnsMapping.php b/app/Models/Import/ColumnsMapping.php index 0f3ac77..e25141b 100644 --- a/app/Models/Import/ColumnsMapping.php +++ b/app/Models/Import/ColumnsMapping.php @@ -19,10 +19,10 @@ * @property int|null $volume_column_index * @property int|null $sender_account_number_column_index * @property int|null $receiver_account_number_column_index - * @method static findOrFail(int $columnsMappingId) - * @method static latest() - * @method static create(array $data) - * @method static whereUser(User $user) + * @method static findOrFail(int $columnsMappingId) + * @method static latest() + * @method static create(array $data) + * @method static whereUser(User $user) */ class ColumnsMapping extends Model { diff --git a/app/Models/Import/Import.php b/app/Models/Import/Import.php index 0c6a498..85ca939 100644 --- a/app/Models/Import/Import.php +++ b/app/Models/Import/Import.php @@ -18,8 +18,8 @@ * @property int|null $file_id * @property int|null $synchronization_id * @property int $transactions_skipped_count - * @method static create(array $data) - * @method static whereUser(\App\Models\User $user) + * @method static create(array $data) + * @method static whereUser(\App\Models\User $user) */ class Import extends Model { diff --git a/app/Models/Import/ImportSetting.php b/app/Models/Import/ImportSetting.php index 7c58e9d..fe02801 100644 --- a/app/Models/Import/ImportSetting.php +++ b/app/Models/Import/ImportSetting.php @@ -15,10 +15,10 @@ * @property int|null $start_row * @property int $id * @property mixed $user_id - * @method static findOrFail(int $importSettingId) - * @method static latest() - * @method static create(array $validatedData) - * @method static whereUser(User $user) + * @method static findOrFail(int $importSettingId) + * @method static latest() + * @method static create(array $validatedData) + * @method static whereUser(User $user) */ class ImportSetting extends Model { diff --git a/app/Models/Nordigen/EndUserAgreement.php b/app/Models/Nordigen/EndUserAgreement.php index 41803fd..bbdb265 100644 --- a/app/Models/Nordigen/EndUserAgreement.php +++ b/app/Models/Nordigen/EndUserAgreement.php @@ -11,13 +11,13 @@ /** * @property string|null $nordigen_institution_id - * @var bool $is_successful - * @var Collection $requisitions - * @method static create(array $array) - * @method static firstWhere(string|array $attribute, mixed $value = null) - * @method static findOrFail(mixed $endUserAgreementId) - * @method static latest() - * @method static whereUser(User $user) + * @var bool $is_successful + * @var Collection $requisitions + * @method static create(array $array) + * @method static firstWhere(string|array $attribute, mixed $value = null) + * @method static findOrFail(mixed $endUserAgreementId) + * @method static latest() + * @method static whereUser(User $user) */ class EndUserAgreement extends Model { diff --git a/app/Models/Nordigen/Requisition.php b/app/Models/Nordigen/Requisition.php index e5613a8..5c262b0 100644 --- a/app/Models/Nordigen/Requisition.php +++ b/app/Models/Nordigen/Requisition.php @@ -7,9 +7,9 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; /** - * @method static create(array $array) - * @method static latest() - * @method static whereUser($user) + * @method static create(array $array) + * @method static latest() + * @method static whereUser($user) * @property mixed $nordigen_requisition_id */ class Requisition extends Model diff --git a/app/Models/Notification.php b/app/Models/Notification.php index 5e6fb22..9787822 100644 --- a/app/Models/Notification.php +++ b/app/Models/Notification.php @@ -9,8 +9,8 @@ /** * @property string $content * @property int $id - * @method static whereUser(User $user) - * @method static create(array $array) + * @method static whereUser(User $user) + * @method static create(array $array) */ class Notification extends Model { diff --git a/app/Models/Synchronization/Account.php b/app/Models/Synchronization/Account.php index 49a0a93..740855b 100644 --- a/app/Models/Synchronization/Account.php +++ b/app/Models/Synchronization/Account.php @@ -8,10 +8,10 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; /** - * @method static create(array $array) - * @method static firstOrCreate(array $attributes, array $data) - * @method static latest() - * @method static whereUser(User $user) + * @method static create(array $array) + * @method static firstOrCreate(array $attributes, array $data) + * @method static latest() + * @method static whereUser(User $user) * @property int $id * @property string $nordigen_account_id */ diff --git a/app/Models/Synchronization/Synchronization.php b/app/Models/Synchronization/Synchronization.php index 10afb93..eea1d25 100644 --- a/app/Models/Synchronization/Synchronization.php +++ b/app/Models/Synchronization/Synchronization.php @@ -11,9 +11,9 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; /** - * @var Carbon $created_at - * @method static create(array $data) - * @method static whereUser(User $user) + * @var Carbon $created_at + * @method static create(array $data) + * @method static whereUser(User $user) * @property mixed $id * @property int $code * @property int $status diff --git a/app/Models/Transaction/Category.php b/app/Models/Transaction/Category.php index 039ac4a..d56a595 100644 --- a/app/Models/Transaction/Category.php +++ b/app/Models/Transaction/Category.php @@ -10,7 +10,7 @@ /** * @property string $code - * @method static firstOrCreate(string[] $categoryData) + * @method static firstOrCreate(string[] $categoryData) */ class Category extends Model { diff --git a/app/Models/Transaction/Persona.php b/app/Models/Transaction/Persona.php index 5ac25e3..7247104 100644 --- a/app/Models/Transaction/Persona.php +++ b/app/Models/Transaction/Persona.php @@ -7,9 +7,9 @@ use Illuminate\Database\Eloquent\Relations\HasMany; /** - * @method static create(array $array) - * @method static orderBy(string $string) - * @method static withCount(string $string, string $string1) + * @method static create(array $array) + * @method static orderBy(string $string) + * @method static withCount(string $string, string $string1) * @property string $associated_names * @property int $id * @property string $common_name diff --git a/app/Models/Transaction/PersonalAccount.php b/app/Models/Transaction/PersonalAccount.php index 68bb9d4..d0c557f 100644 --- a/app/Models/Transaction/PersonalAccount.php +++ b/app/Models/Transaction/PersonalAccount.php @@ -9,7 +9,7 @@ /** * @property mixed $value - * @method static whereUser(mixed $user) + * @method static whereUser(mixed $user) */ class PersonalAccount extends Model { diff --git a/app/Models/Transaction/Transaction.php b/app/Models/Transaction/Transaction.php index 28b2205..0f74484 100644 --- a/app/Models/Transaction/Transaction.php +++ b/app/Models/Transaction/Transaction.php @@ -16,17 +16,17 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; /** - * @method static applyFilter(Filter $filter) - * @method static create(array $data) - * @method static firstWhere(array $attributes) - * @method static findOrFail(int $id) - * @method static cursor() - * @method static count() - * @method static whereExpenditure() - * @method static whereMonthAndYear(Carbon $now) - * @method static orderByTransactionDate() - * @method static whereUser(User $user) - * @method static chunk(int $chunkSize, \Closure $param) + * @method static applyFilter(Filter $filter) + * @method static create(array $data) + * @method static firstWhere(array $attributes) + * @method static findOrFail(int $id) + * @method static cursor() + * @method static count() + * @method static whereExpenditure() + * @method static whereMonthAndYear(Carbon $now) + * @method static orderByTransactionDate() + * @method static whereUser(User $user) + * @method static chunk(int $chunkSize, \Closure $param) * @property string $sender Sender name. * @property string $receiver Receiver name. * @property int $id Transaction primary key. @@ -102,8 +102,7 @@ public function synchronization(): BelongsTo public static function getFilterableColumns(): Collection { - return collect( - [ + return collect([ 'transaction_date' => [ 'operators' => ['lte', 'eq', 'gte', 'lt', 'gt'], 'input' => 'date', @@ -132,8 +131,7 @@ public static function getFilterableColumns(): Collection 'operators' => ['eq'], 'input' => 'text', ], - ] - ); + ]); } public function senderPersona(): BelongsTo diff --git a/app/Models/User.php b/app/Models/User.php index 09f891f..453575c 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -25,9 +25,9 @@ * @property Settings|null $settings * @property Collection $personalAccounts * @property Collection $budgets - * @method static cursor() - * @method static firstWhere(array $array) - * @method static findOrFail(mixed $userId) + * @method static cursor() + * @method static firstWhere(array $array) + * @method static findOrFail(mixed $userId) */ class User extends Authenticatable { diff --git a/app/Observers/Import/ImportObserver.php b/app/Observers/Import/ImportObserver.php index 74995ef..31a5c91 100644 --- a/app/Observers/Import/ImportObserver.php +++ b/app/Observers/Import/ImportObserver.php @@ -8,12 +8,10 @@ readonly class ImportObserver { - public function __construct(private CategorizeTransactionService $categorizeTransactionService) - { - } + public function __construct(private CategorizeTransactionService $categorizeTransactionService) {} /** - * @throws Throwable + * @throws Throwable * @noinspection PhpMissingReturnTypeInspection */ public function created(Import $import) diff --git a/app/Observers/Transaction/TransactionObserver.php b/app/Observers/Transaction/TransactionObserver.php index 9a0041d..ade33b9 100644 --- a/app/Observers/Transaction/TransactionObserver.php +++ b/app/Observers/Transaction/TransactionObserver.php @@ -28,7 +28,7 @@ public function updating(Transaction $transaction): void { $this->cacheAdapter->clearUserCache($transaction->user); - if($transaction->isDirty('category_id')) { + if($transaction->isDirty('category_id')){ SaveTransactionCategoryReference::dispatch($transaction->id); } } diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index 6f55e51..2be04f5 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -14,6 +14,6 @@ public function boot(): void { Broadcast::routes(); - include base_path('routes/channels.php'); + require base_path('routes/channels.php'); } } diff --git a/app/Providers/HorizonServiceProvider.php b/app/Providers/HorizonServiceProvider.php index e557270..76c42e5 100644 --- a/app/Providers/HorizonServiceProvider.php +++ b/app/Providers/HorizonServiceProvider.php @@ -29,14 +29,10 @@ public function boot(): void */ protected function gate(): void { - Gate::define( - 'viewHorizon', function ($user) { - return in_array( - $user->email, [ - // - ] - ); - } - ); + Gate::define('viewHorizon', function ($user) { + return in_array($user->email, [ + // + ]); + }); } } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 90e8667..4df3bd9 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -33,16 +33,14 @@ public function boot(): void { $this->configureRateLimiting(); - $this->routes( - function () { - Route::middleware('api') - ->prefix('api') - ->group(base_path('routes/api.php')); + $this->routes(function () { + Route::middleware('api') + ->prefix('api') + ->group(base_path('routes/api.php')); - Route::middleware('web') + Route::middleware('web') ->group(base_path('routes/web.php')); - } - ); + }); } /** @@ -50,10 +48,8 @@ function () { */ protected function configureRateLimiting(): void { - RateLimiter::for( - 'api', function (Request $request) { - return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); - } - ); + RateLimiter::for('api', function (Request $request) { + return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); + }); } } diff --git a/app/Providers/TelescopeServiceProvider.php b/app/Providers/TelescopeServiceProvider.php index 59f5def..338d2c8 100644 --- a/app/Providers/TelescopeServiceProvider.php +++ b/app/Providers/TelescopeServiceProvider.php @@ -18,19 +18,17 @@ public function register(): void $this->hideSensitiveRequestDetails(); - Telescope::filter( - function (IncomingEntry $entry) { - if ($this->app->environment('local')) { - return true; - } + Telescope::filter(function (IncomingEntry $entry) { + if ($this->app->environment('local')) { + return true; + } - return $entry->isReportableException() || + return $entry->isReportableException() || $entry->isFailedRequest() || $entry->isFailedJob() || $entry->isScheduledTask() || $entry->hasMonitoredTag(); - } - ); + }); } /** @@ -44,13 +42,11 @@ protected function hideSensitiveRequestDetails(): void Telescope::hideRequestParameters(['_token']); - Telescope::hideRequestHeaders( - [ + Telescope::hideRequestHeaders([ 'cookie', 'x-csrf-token', 'x-xsrf-token', - ] - ); + ]); } /** @@ -60,14 +56,10 @@ protected function hideSensitiveRequestDetails(): void */ protected function gate(): void { - Gate::define( - 'viewTelescope', function ($user) { - return in_array( - $user->email, [ - 'text@example.com' - ] - ); - } - ); + Gate::define('viewTelescope', function ($user) { + return in_array($user->email, [ + 'text@example.com' + ]); + }); } } diff --git a/app/Services/Analytics/AnalyticsService.php b/app/Services/Analytics/AnalyticsService.php index 9ded43a..d64beca 100644 --- a/app/Services/Analytics/AnalyticsService.php +++ b/app/Services/Analytics/AnalyticsService.php @@ -20,9 +20,7 @@ public function getChartData(User $user, string $chartQueryId): array 'expendituresAndIncomesTrend' => ExpendituresAndIncomesTrend::class }; - /** - * @var ChartQuery $chartQuery -*/ + /** @var ChartQuery $chartQuery */ $chartQuery = app($chartQueryClass); return $chartQuery->get($user); } diff --git a/app/Services/Analytics/ChartQueries/CategoriesPercentage.php b/app/Services/Analytics/ChartQueries/CategoriesPercentage.php index d2698a4..8149f11 100644 --- a/app/Services/Analytics/ChartQueries/CategoriesPercentage.php +++ b/app/Services/Analytics/ChartQueries/CategoriesPercentage.php @@ -12,14 +12,12 @@ class CategoriesPercentage extends ChartQuery public function get(User $user): array { $categories = Category::query() - ->withCount( - [ + ->withCount([ 'transactions as transactions_count' => function ($query) use ($user) { $query ->baseCalculationQuery() ->where('user_id', $user->id); - }] - ) + }]) ->get(); $totalTransactionsCategorized = $categories->sum('transactions_count'); @@ -28,12 +26,10 @@ public function get(User $user): array $categoriesValues = []; $categories - ->each( - function ($category) use ($totalTransactionsCategorized, &$categoriesLabels, &$categoriesValues) { - $categoriesLabels[] = Str::ucfirst($category->code); - $categoriesValues[] = $totalTransactionsCategorized ? $category->transactions_count / $totalTransactionsCategorized : 0; - } - ); + ->each(function ($category) use ($totalTransactionsCategorized, &$categoriesLabels, &$categoriesValues) { + $categoriesLabels[] = Str::ucfirst($category->code); + $categoriesValues[] = $totalTransactionsCategorized ? $category->transactions_count / $totalTransactionsCategorized : 0; + }); return DoughnutChart::make( header: ' Of category', diff --git a/app/Services/Analytics/ChartQueries/CategorizedPercentage.php b/app/Services/Analytics/ChartQueries/CategorizedPercentage.php index 7794cfb..7ea2846 100644 --- a/app/Services/Analytics/ChartQueries/CategorizedPercentage.php +++ b/app/Services/Analytics/ChartQueries/CategorizedPercentage.php @@ -12,14 +12,12 @@ class CategorizedPercentage extends ChartQuery public function get(User $user): array { $categories = Category::query() - ->withCount( - [ + ->withCount([ 'transactions as transactions_count' => function ($query) use ($user) { $query ->baseCalculationQuery() ->where('user_id', $user->id); - }] - ) + }]) ->get(); $totalTransactions = Transaction::whereUser($user)->baseCalculationQuery()->count(); diff --git a/app/Services/Analytics/Charts/Traits/UseGenerateSimilarColors.php b/app/Services/Analytics/Charts/Traits/UseGenerateSimilarColors.php index 4f5efd6..18f052d 100644 --- a/app/Services/Analytics/Charts/Traits/UseGenerateSimilarColors.php +++ b/app/Services/Analytics/Charts/Traits/UseGenerateSimilarColors.php @@ -22,13 +22,11 @@ protected static function generateColors(int $count): array protected static function generateRandomColor(): string { - $randomizedRgb = array_map( - function ($value) { - $randomValue = mt_rand(-100, 100); - $newValue = $value + $randomValue; - return max(0, min(255, $newValue)); - }, self::getBaseRGBValues() - ); + $randomizedRgb = array_map(function ($value) { + $randomValue = mt_rand(-100, 100); + $newValue = $value + $randomValue; + return max(0, min(255, $newValue)); + }, self::getBaseRGBValues()); return sprintf("#%02x%02x%02x", ...$randomizedRgb); } diff --git a/app/Services/Auth/Api/UserService.php b/app/Services/Auth/Api/UserService.php index 4181139..ee41348 100644 --- a/app/Services/Auth/Api/UserService.php +++ b/app/Services/Auth/Api/UserService.php @@ -44,9 +44,7 @@ public function login(array $data): array ]; } - /** - * @noinspection PhpPossiblePolymorphicInvocationInspection - */ + /** @noinspection PhpPossiblePolymorphicInvocationInspection */ public function logout(Authenticatable $user): void { $user->tokens()->delete(); diff --git a/app/Services/Auth/Device/DeviceService.php b/app/Services/Auth/Device/DeviceService.php index b55c0f4..36da37a 100644 --- a/app/Services/Auth/Device/DeviceService.php +++ b/app/Services/Auth/Device/DeviceService.php @@ -10,9 +10,7 @@ readonly class DeviceService { - public function __construct(private NotificationBroadcastService $notificationBroadcastService) - { - } + public function __construct(private NotificationBroadcastService $notificationBroadcastService) {} public function all(User $user): Collection { diff --git a/app/Services/Auth/Registration/OneTimeToken/TokenRegistrationService.php b/app/Services/Auth/Registration/OneTimeToken/TokenRegistrationService.php index 96312ae..7de5ebc 100644 --- a/app/Services/Auth/Registration/OneTimeToken/TokenRegistrationService.php +++ b/app/Services/Auth/Registration/OneTimeToken/TokenRegistrationService.php @@ -7,9 +7,7 @@ readonly class TokenRegistrationService { - public function __construct(private CacheAdapterInterface $cacheAdapter) - { - } + public function __construct(private CacheAdapterInterface $cacheAdapter) {} private const ONE_TIME_REGISTRATION_TOKEN_CACHE_KEY = 'auth_one_time_registration_token'; diff --git a/app/Services/ExchangeRates/DataObjects/HistoricalExchangeRateDataObject.php b/app/Services/ExchangeRates/DataObjects/HistoricalExchangeRateDataObject.php index 4d6957b..55894d5 100644 --- a/app/Services/ExchangeRates/DataObjects/HistoricalExchangeRateDataObject.php +++ b/app/Services/ExchangeRates/DataObjects/HistoricalExchangeRateDataObject.php @@ -12,8 +12,7 @@ public function __construct( public string $rate, public string $baseCurrencyCode, public string $targetCurrencyCode, - ) { - } + ) {} public static function make(mixed $data): self { diff --git a/app/Services/ExchangeRates/ExchangeRatesService.php b/app/Services/ExchangeRates/ExchangeRatesService.php index 625f693..90c3c69 100644 --- a/app/Services/ExchangeRates/ExchangeRatesService.php +++ b/app/Services/ExchangeRates/ExchangeRatesService.php @@ -16,9 +16,7 @@ class ExchangeRatesService implements ExchangeRatesServiceInterface { use DecodesHttpJsonResponse; - public function __construct(private readonly ExchangeRatesClient $exchangeRatesClient) - { - } + public function __construct(private readonly ExchangeRatesClient $exchangeRatesClient) { } public function all(): Collection { @@ -40,14 +38,12 @@ public function getOrCreateExchangeRate(Carbon $date, string $baseCurrencyCode, if (!$exchangeRate) { $dataObject = $this->provideNewHistoryRate($date, $baseCurrencyCode, $targetCurrencyCode); - return ExchangeRate::create( - [ + return ExchangeRate::create([ 'rate' => $dataObject->rate, 'base_currency' => $dataObject->baseCurrencyCode, 'target_currency' => $dataObject->targetCurrencyCode, 'rate_source_date' => $dataObject->date, - ] - ); + ]); } return $exchangeRate; @@ -61,14 +57,12 @@ public function provideNewHistoryRate(Carbon $date, string $baseCurrencyCode, st { $dateString = $date->format('Y-m-d'); - $response = $this->exchangeRatesClient->get( - "/exchangerates_data/$dateString", [ + $response = $this->exchangeRatesClient->get("/exchangerates_data/$dateString", [ 'query' => [ 'base' => $baseCurrencyCode, 'symbols' => $targetCurrencyCode, ], - ] - ); + ]); $responseData = $this->decodedResponse($response); diff --git a/app/Services/ExchangeRates/Provider/ExchangeRatesServiceProvider.php b/app/Services/ExchangeRates/Provider/ExchangeRatesServiceProvider.php index 941dfcf..2b57ebb 100644 --- a/app/Services/ExchangeRates/Provider/ExchangeRatesServiceProvider.php +++ b/app/Services/ExchangeRates/Provider/ExchangeRatesServiceProvider.php @@ -11,19 +11,15 @@ class ExchangeRatesServiceProvider extends ServiceProvider { public function register(): void { - $this->app->singleton( - ExchangeRatesClient::class, function ($app) { - return new ExchangeRatesClient( - [ - 'base_uri' => $app->config->get('exchange_rates.base_uri'), - 'headers' => [ + $this->app->singleton(ExchangeRatesClient::class, function ($app) { + return new ExchangeRatesClient([ + 'base_uri' => $app->config->get('exchange_rates.base_uri'), + 'headers' => [ 'apikey' => $app->config->get('exchange_rates.api_key'), 'Accept' => 'application/json', - ], - ] - ); - } - ); + ], + ]); + }); $this->app->bind(ExchangeRatesServiceInterface::class, ExchangeRatesService::class); } diff --git a/app/Services/File/FileUploadService.php b/app/Services/File/FileUploadService.php index 5d6cc78..5cc825f 100644 --- a/app/Services/File/FileUploadService.php +++ b/app/Services/File/FileUploadService.php @@ -12,7 +12,8 @@ public function __construct( private ProfileFileService $profileFileService, private TransactionFileService $transactionFileService - ) { + ) + { } /** @@ -37,11 +38,9 @@ public function upload(User $user, UploadedFile $file, array $data): void ); } catch(\Throwable) { - throw ValidationException::withMessages( - [ + throw ValidationException::withMessages([ 'file' => 'Invalid file, please check import configuration.' - ] - ); + ]); } } } diff --git a/app/Services/File/Traits/RegistersFileInDBAndStoresOnDisk.php b/app/Services/File/Traits/RegistersFileInDBAndStoresOnDisk.php index 95a98ac..fd80c1a 100644 --- a/app/Services/File/Traits/RegistersFileInDBAndStoresOnDisk.php +++ b/app/Services/File/Traits/RegistersFileInDBAndStoresOnDisk.php @@ -10,11 +10,9 @@ trait RegistersFileInDBAndStoresOnDisk { protected function registerAndStoreFile(File $fileModel, UploadedFile $fileObj, string $fileName): void { - DB::transaction( - function () use ($fileModel, $fileObj, $fileName) { - $fileModel->save(); - $fileObj->storeAs('uploads', $fileName); - } - ); + DB::transaction(function () use ($fileModel, $fileObj, $fileName) { + $fileModel->save(); + $fileObj->storeAs('uploads', $fileName); + }); } } diff --git a/app/Services/File/TransactionFileService.php b/app/Services/File/TransactionFileService.php index 0f94dc3..cdae2e0 100644 --- a/app/Services/File/TransactionFileService.php +++ b/app/Services/File/TransactionFileService.php @@ -12,9 +12,7 @@ class TransactionFileService { use RegistersFileInDBAndStoresOnDisk; - public function __construct(private readonly ImportService $importService) - { - } + public function __construct(private readonly ImportService $importService) {} public function uploadTransactions(mixed $requestFile, mixed $importSettingId, mixed $columnMappingId, User $user): void { diff --git a/app/Services/FileExplorer/DirectoryRenderBuilder.php b/app/Services/FileExplorer/DirectoryRenderBuilder.php index ac1638b..0e34033 100644 --- a/app/Services/FileExplorer/DirectoryRenderBuilder.php +++ b/app/Services/FileExplorer/DirectoryRenderBuilder.php @@ -28,23 +28,19 @@ public function build(): self $directoryName = $this->getShortEntityName($path); $sourcePath = $this->targetPath . '/' . $directoryName; - $this->render .= view( - 'file_explorer.partials.folder', [ + $this->render .= view('file_explorer.partials.folder', [ 'url' => route('api.file_explorer.open', ['path' => $sourcePath]), 'directoryName' => $directoryName, - ] - )->render(); + ])->render(); } foreach (Storage::files($this->targetPath) as $path) { $fileName = $this->getShortEntityName($path); - $this->render .= view( - 'file_explorer.partials.file', [ + $this->render .= view('file_explorer.partials.file', [ 'file' => $fileName, 'filePath' => $this->targetPath . '/' . $fileName - ] - )->render(); + ])->render(); } if ($this->render === '') { diff --git a/app/Services/FileExplorer/FileRenderBuilder.php b/app/Services/FileExplorer/FileRenderBuilder.php index 546cd7d..8190ad5 100644 --- a/app/Services/FileExplorer/FileRenderBuilder.php +++ b/app/Services/FileExplorer/FileRenderBuilder.php @@ -74,11 +74,9 @@ public function getRenderedFile(): ?string protected function renderAsBinaryFile(): string { $this->fileType = self::FILE_TYPE_BINARY; - return view( - 'file_explorer.partials.binary-file', [ + return view('file_explorer.partials.binary-file', [ 'fileName' => $this->fileName - ] - )->render(); + ])->render(); } protected function renderAsVideoFile(): string @@ -86,34 +84,28 @@ protected function renderAsVideoFile(): string $this->fileType = self::FILE_TYPE_VIDEO; $extension = FileHelper::extractExtension($this->fileName); - return view( - 'file_explorer.partials.video-file', [ + return view('file_explorer.partials.video-file', [ 'fileName' => $this->fileName, 'fileExtension' => $extension, 'src' => route('api.file_explorer.get', ['path' => $this->storageFilePath]) - ] - )->render(); + ])->render(); } protected function renderAsTextFile(string $content): string { - return view( - 'file_explorer.partials.text-file', [ + return view('file_explorer.partials.text-file', [ 'fileName' => $this->fileName, 'content' => $content - ] - )->render(); + ])->render(); } protected function renderAsImageFile(): string { $this->fileType = self::FILE_TYPE_IMAGE; - return view( - 'file_explorer.partials.image-file', [ + return view('file_explorer.partials.image-file', [ 'fileName' => $this->fileName, 'src' => route('api.file_explorer.get', ['path' => $this->storageFilePath]) - ] - )->render(); + ])->render(); } public function getFileType(): ?string diff --git a/app/Services/Helpers/StringHelper.php b/app/Services/Helpers/StringHelper.php index 7794a16..8cc48c4 100644 --- a/app/Services/Helpers/StringHelper.php +++ b/app/Services/Helpers/StringHelper.php @@ -39,8 +39,8 @@ public static function findLongestCommonSubstringInArray(array $strings): string * in two given strings. The algorithm runs in linear time O(mn), * where m and n are the lengths of the input strings. * - * @param string $str1 - * @param string $str2 + * @param string $str1 + * @param string $str2 * @return string */ public static function findLongestCommonSubstring(string $str1, string $str2): string @@ -80,14 +80,13 @@ public static function findLongestCommonSubstring(string $str1, string $str2): s * WordPress' implementation of function which * removes accents of different languages from string. * - * @param $string + * @param $string * @return string */ public static function removeAccents($string): string { - if (!preg_match('/[\x80-\xff]/', $string)) { + if (!preg_match('/[\x80-\xff]/', $string)) return $string; - } $chars = array( // Decompositions for Latin-1 Supplement diff --git a/app/Services/Helpers/TimeHelper.php b/app/Services/Helpers/TimeHelper.php index 2e4602a..11fc809 100644 --- a/app/Services/Helpers/TimeHelper.php +++ b/app/Services/Helpers/TimeHelper.php @@ -6,17 +6,15 @@ class TimeHelper { /** * Returns rough (in largest single unit) time elapsed between two times. - * - * @param int $iTime0 Initial time, as time_t. - * @param int $iTime1 Final time, as time_t. 0=use current time. + * @param int $iTime0 Initial time, as time_t. + * @param int $iTime1 Final time, as time_t. 0=use current time. * @return string Time elapsed, like "5 minutes" or "3 days" or "1 month". * You might print "ago" after this return if $iTime1 is now. * @author Dan Kamins - dos at axonchisel dot net */ static function ax_getRoughTimeElapsedAsText(int $iTime0, int $iTime1 = 0): string { - if ($iTime1 == 0) { $iTime1 = time(); - } + if ($iTime1 == 0) { $iTime1 = time(); } $iTimeElapsed = $iTime1 - $iTime0; if ($iTimeElapsed < (60)) { diff --git a/app/Services/Home/HomePageService.php b/app/Services/Home/HomePageService.php index 8bfffb6..e92254b 100644 --- a/app/Services/Home/HomePageService.php +++ b/app/Services/Home/HomePageService.php @@ -22,13 +22,13 @@ public function __construct( private readonly TransactionQuerySet $transactionQuerySet, private readonly SynchronizationService $synchronizationService, private readonly TransactionSyncServiceInterface $transactionSyncService, - ) { + ) + { } public function getHomeData(User $user): Collection { - return collect( - [ + return collect([ 'user' => $user, 'budgetsWithConsumption' => $this->budgetService->allWithConsumption($user), 'currencyCode' => $this->currencyService->resolveCalculationCurrency($user), @@ -45,7 +45,6 @@ public function getHomeData(User $user): Collection 'transactions' => $this->transactionQuerySet->getTenLatestTransactionsByUserForHomePage($user), 'last_synchronization' => $this->synchronizationService->getLatestSucceededByUser($user) ] - ] - ); + ]); } } diff --git a/app/Services/Home/HomePageServiceCachingDecorator.php b/app/Services/Home/HomePageServiceCachingDecorator.php index 1cd7887..365d3d7 100644 --- a/app/Services/Home/HomePageServiceCachingDecorator.php +++ b/app/Services/Home/HomePageServiceCachingDecorator.php @@ -11,7 +11,8 @@ public function __construct( private CacheAdapterInterface $cacheAdapter, private HomePageService $homePageService - ) { + ) + { } public function getHomeData(User $user): Collection diff --git a/app/Services/Import/ImportService.php b/app/Services/Import/ImportService.php index daf9011..40a1819 100644 --- a/app/Services/Import/ImportService.php +++ b/app/Services/Import/ImportService.php @@ -34,23 +34,19 @@ public function importFromFile(int $fileId, int $importSettingId, int $columnsMa $columnsMapping = ColumnsMapping::findOrFail($columnsMappingId); $file = File::findOrFail($fileId); - $import = new Import( - [ + $import = new Import([ 'user_id' => $user->id, 'status' => Import::STATUS_PROCESSING, 'columns_mapping_id' => $columnsMappingId, 'import_setting_id' => $importSettingId, 'file_id' => $file->id, - ] - ); + ]); $import->save(); - DB::transaction( - function () use ($file, $importSetting, $columnsMapping, $import, $user) { - Excel::import(new TransactionsImport($importSetting, $columnsMapping, $import, $user), $file->path); - } - ); + DB::transaction(function () use ($file, $importSetting, $columnsMapping, $import, $user) { + Excel::import(new TransactionsImport($importSetting, $columnsMapping, $import, $user), $file->path); + }); $import->update(['status' => Import::STATUS_SAVED]); diff --git a/app/Services/Meta/MetaService.php b/app/Services/Meta/MetaService.php index 909af5b..b6ac4c7 100644 --- a/app/Services/Meta/MetaService.php +++ b/app/Services/Meta/MetaService.php @@ -12,7 +12,8 @@ public function __construct( private ShellService $shellService, private CacheAdapterInterface $cacheAdapter - ) { + ) + { } public function getAppMetaData(): array @@ -54,9 +55,7 @@ public function getTopProcesses(): array return ['processes' => $this->getTopData()]; } - /** - * @noinspection SqlDialectInspection - */ + /** @noinspection SqlDialectInspection */ public function getTablesSizes(): array { return DB::table('information_schema.TABLES') @@ -100,15 +99,13 @@ public function getJobsList(): Collection $jobs = DB::table('jobs')->select()->latest()->get(); if ($jobs->count() === 0) { - $jobs = collect( - [ + $jobs = collect([ [ 'id' => 10, 'name' => 'CategorizeTransaction', 'queued_at' => '02-12-1999 13:12' ], - ] - ); + ]); } return $jobs; diff --git a/app/Services/Nordigen/DataObjects/TransactionDataObject.php b/app/Services/Nordigen/DataObjects/TransactionDataObject.php index ff863ce..985da19 100644 --- a/app/Services/Nordigen/DataObjects/TransactionDataObject.php +++ b/app/Services/Nordigen/DataObjects/TransactionDataObject.php @@ -7,43 +7,34 @@ class TransactionDataObject extends DataObject { public function __construct( - /** - * @var string $rawVolume Operation raw volume - */ + /** @var string $rawVolume Operation raw volume */ public string $rawVolume, - /** - * @var string $currency Operation currency code - */ + + /** @var string $currency Operation currency code */ public string $currency, - /** - * @var string $valueDate Operation execution date - */ + + /** @var string $valueDate Operation execution date */ public string $valueDate, - /** - * @var string|null $bookingDate Operation booking date - */ + + /** @var string|null $bookingDate Operation booking date */ public ?string $bookingDate, - /** - * @var string|null $debtorName Operation sender name - */ + + /** @var string|null $debtorName Operation sender name */ public ?string $debtorName, - /** - * @var string|null $creditorName Operation receiver name - */ + + /** @var string|null $creditorName Operation receiver name */ public ?string $creditorName, - /** - * @var string|null $remittanceInformationUnstructured Operation details/description - */ + + /** @var string|null $remittanceInformationUnstructured Operation details/description */ public ?string $remittanceInformationUnstructured, - /** - * @var string|null $senderAccountNumber Sender IBAN Number - */ + + /** @var string|null $senderAccountNumber Sender IBAN Number */ public ?string $senderAccountNumber, - /** - * @var string|null $receiverAccountNumber Receiver IBAN Number - */ + + /** @var string|null $receiverAccountNumber Receiver IBAN Number */ public ?string $receiverAccountNumber, - ) { + ) + { } public static function make(mixed $data): self diff --git a/app/Services/Nordigen/NordigenService.php b/app/Services/Nordigen/NordigenService.php index e78dc83..c5c2ce1 100644 --- a/app/Services/Nordigen/NordigenService.php +++ b/app/Services/Nordigen/NordigenService.php @@ -1,6 +1,4 @@ -nordigenAccountService->all($user); foreach ($accounts as $account) { - $import = Import::create( - [ + $import = Import::create([ 'user_id' => $user->id, 'synchronization_id' => $synchronizationId, 'status' => Import::STATUS_IMPORTING - ] - ); + ]); try { $this->syncTransactionsByAccount($account, $import, $user); @@ -89,11 +86,9 @@ protected function syncTransactionsByAccount(Account $account, Import $import, U { $uri = self::ACCOUNTS_URI . $account->nordigen_account_id . '/transactions/'; - $response = $this->httpClient->get( - $uri, [ + $response = $this->httpClient->get($uri, [ 'headers' => $this->getAuthorizationHeader(), - ] - ); + ]); $transactionsData = $this->decodedResponse($response); @@ -130,11 +125,9 @@ public function syncAccounts(mixed $requisitionId, mixed $synchronizationId, Use { $uri = self::NEW_REQUISITION_URI . $requisitionId . '/'; - $response = $this->httpClient->get( - $uri, [ + $response = $this->httpClient->get($uri, [ 'headers' => $this->getAuthorizationHeader(), - ] - ); + ]); $accountsData = $this->decodedResponse($response); $accountsIds = data_get($accountsData, 'accounts'); @@ -142,16 +135,14 @@ public function syncAccounts(mixed $requisitionId, mixed $synchronizationId, Use if (is_array($accountsIds)) { foreach ($accountsIds as $accountId) { // @todo add deleting non existing accounts - Account::firstOrCreate( - [ + Account::firstOrCreate([ 'user_id' => $user->id, 'nordigen_account_id' => $accountId, - ], [ + ], [ 'user_id' => $user->id, 'nordigen_account_id' => $accountId, 'synchronization_id' => $synchronizationId, - ] - ); + ]); } } } @@ -187,19 +178,16 @@ public function createNewRequisition(mixed $institutionId, mixed $endUserAgreeme ]; try { - $response = $this->httpClient->post( - self::NEW_REQUISITION_URI, [ + $response = $this->httpClient->post(self::NEW_REQUISITION_URI, [ 'json' => $requestBody, 'headers' => $this->getAuthorizationHeader(), - ] - ); + ]); $requisitionData = $this->decodedResponse($response); $isSuccessful = data_get($requisitionData, 'status') === self::REQUISITION_CREATED_STATUS; if ($isSuccessful) { - return Requisition::create( - [ + return Requisition::create([ 'user_id' => $user->id, 'reference' => data_get($requisitionData, 'reference'), 'link' => data_get($requisitionData, 'link'), @@ -208,8 +196,7 @@ public function createNewRequisition(mixed $institutionId, mixed $endUserAgreeme 'raw_request_body' => json_encode($requestBody), 'end_user_agreement_id' => $endUserAgreement->id, 'nordigen_institution_id' => $institutionId, - ] - ); + ]); } return [ @@ -230,12 +217,10 @@ public function createNewRequisition(mixed $institutionId, mixed $endUserAgreeme public function getExistingAgreementForInstitution(User $user, mixed $institutionId): ?EndUserAgreement { - return EndUserAgreement::firstWhere( - [ + return EndUserAgreement::firstWhere([ 'user_id' => $user->id, 'nordigen_institution_id' => $institutionId - ] - ); + ]); } public function getAgreementById(User $user, mixed $id): ?EndUserAgreement @@ -258,19 +243,16 @@ public function createNewUserAgreement(User $user, mixed $institutionId): EndUse ]; try { - $response = $this->httpClient->post( - self::NEW_END_USER_AGREEMENTS_URI, [ + $response = $this->httpClient->post(self::NEW_END_USER_AGREEMENTS_URI, [ 'json' => $requestBody, 'headers' => $this->getAuthorizationHeader(), - ] - ); + ]); $userAgreementData = $this->decodedResponse($response); $isSuccessful = $response->getStatusCode() > 100 && $response->getStatusCode() < 300; $nordigenCreated = data_get($userAgreementData, 'created'); - return EndUserAgreement::create( - [ + return EndUserAgreement::create([ 'user_id' => $user->id, 'is_successful' => $isSuccessful, 'raw_request_body' => json_encode($requestBody), @@ -278,8 +260,7 @@ public function createNewUserAgreement(User $user, mixed $institutionId): EndUse 'nordigen_institution_id' => data_get($userAgreementData, 'institution_id'), 'nordigen_end_user_agreement_id' => data_get($userAgreementData, 'id'), 'nordigen_end_user_agreement_created' => Carbon::parse($nordigenCreated), - ] - ); + ]); } catch (Throwable $throwable) { return [ @@ -290,9 +271,9 @@ public function createNewUserAgreement(User $user, mixed $institutionId): EndUse } /** - * @return array|InstitutionDataObject[] + * @return array|InstitutionDataObject[] * @noinspection PhpMissingReturnTypeInspection - * @throws GuzzleException + * @throws GuzzleException */ public function provideSupportedInstitutionsData() { @@ -310,7 +291,7 @@ public function provideSupportedInstitutionsData() } /** - * @return array|InstitutionDataObject[] + * @return array|InstitutionDataObject[] * @noinspection PhpMissingReturnTypeInspection */ public function getInstitutionsDataObjects(array $institutionsData): array @@ -333,12 +314,10 @@ public function getFreshSupportedInstitutionsData(): array 'country' => config('nordigen.country'), ]; - $response = $this->httpClient->get( - self::INSTITUTIONS_URI, [ + $response = $this->httpClient->get(self::INSTITUTIONS_URI, [ 'query' => $requestQuery, 'headers' => $this->getAuthorizationHeader(), - ] - ); + ]); return $this->decodedResponse($response); } @@ -372,11 +351,9 @@ public function getFreshTokenData(): array 'secret_key' => config('nordigen.secret_key'), ]; - $response = $this->httpClient->post( - self::NEW_TOKEN_URI, [ + $response = $this->httpClient->post(self::NEW_TOKEN_URI, [ 'json' => $requestBody, - ] - ); + ]); return $this->decodedResponse($response); } @@ -412,22 +389,18 @@ public function getInstitutionByExternalId(mixed $institutionId): ?InstitutionDa public function setStatusSucceeded(Synchronization $synchronization): void { - $synchronization->update( - [ + $synchronization->update([ 'status' => Synchronization::SYNC_STATUS_SUCCEEDED, 'code' => 200 - ] - ); + ]); } public function setStatusFailed(Synchronization $synchronization, ?int $status = null): void { - $synchronization->update( - [ + $synchronization->update([ 'status' => Synchronization::SYNC_STATUS_FAILED, 'code' => $status - ] - ); + ]); } protected function hasTokenRefreshExpired(?array $tokenData): bool diff --git a/app/Services/Nordigen/Provider/NordigenServiceProvider.php b/app/Services/Nordigen/Provider/NordigenServiceProvider.php index fbda800..a89b69a 100644 --- a/app/Services/Nordigen/Provider/NordigenServiceProvider.php +++ b/app/Services/Nordigen/Provider/NordigenServiceProvider.php @@ -11,16 +11,12 @@ class NordigenServiceProvider extends ServiceProvider { public function register(): void { - $this->app->singleton( - NordigenClient::class, function ($app) { - return new NordigenClient( - [ - 'base_uri' => $app->config->get('nordigen.base_uri'), - 'headers' => $app->config->get('nordigen.headers'), - ] - ); - } - ); + $this->app->singleton(NordigenClient::class, function ($app) { + return new NordigenClient([ + 'base_uri' => $app->config->get('nordigen.base_uri'), + 'headers' => $app->config->get('nordigen.headers'), + ]); + }); $this->app->bind(NordigenTransactionServiceInterface::class, TransactionSyncService::class); } diff --git a/app/Services/Notification/Broadcast/NotificationBroadcastService.php b/app/Services/Notification/Broadcast/NotificationBroadcastService.php index e6183e5..0ee3a67 100644 --- a/app/Services/Notification/Broadcast/NotificationBroadcastService.php +++ b/app/Services/Notification/Broadcast/NotificationBroadcastService.php @@ -16,19 +16,15 @@ public function sendStoredApplicationNotification( mixed $userId = null, ?int $type = null ): void { - Notification::create( - [ + Notification::create([ 'user_id' => $userId, - 'content' => json_encode( - [ + 'content' => json_encode([ 'header' => $header, 'content' => $content, 'url' => $url, - ] - ), + ]), 'type' => $type ?? Notification::TYPE_INFO - ] - ); + ]); // @todo - broadcast only to specific users try { diff --git a/app/Services/Transaction/Budget/BudgetConsumtptionService.php b/app/Services/Transaction/Budget/BudgetConsumtptionService.php index d179e52..cb11a02 100644 --- a/app/Services/Transaction/Budget/BudgetConsumtptionService.php +++ b/app/Services/Transaction/Budget/BudgetConsumtptionService.php @@ -10,9 +10,7 @@ class BudgetConsumtptionService { - public function __construct(private readonly TransactionQuerySet $transactionQuerySet) - { - } + public function __construct(private readonly TransactionQuerySet $transactionQuerySet) {} public function getBudgetsConsumptionByUser(User $user): Collection { @@ -36,14 +34,12 @@ public function getBudgetsConsumptionByUser(User $user): Collection ->getExpendituresSumByDates($user, $weekDates); } - $budgetsConsumptionData->push( - [ + $budgetsConsumptionData->push([ 'budget' => $budget, 'budget_amount' => (float) $budget->amount, 'period_expenditures_sum' => (float) $periodExpendituresSum, 'consumption' => (float) abs($periodExpendituresSum / $budget->amount), - ] - ); + ]); } return $budgetsConsumptionData; diff --git a/app/Services/Transaction/Budget/BudgetService.php b/app/Services/Transaction/Budget/BudgetService.php index 4076c68..dc6a63a 100644 --- a/app/Services/Transaction/Budget/BudgetService.php +++ b/app/Services/Transaction/Budget/BudgetService.php @@ -11,8 +11,7 @@ public function __construct( private DefaultBudgetService $defaultBudgetService, private BudgetConsumtptionService $budgetConsumptionService - ) { - } + ) {} public function allWithConsumption(User $user): Collection { @@ -35,12 +34,10 @@ public function update(Budget $budget, mixed $data): Budget public function findOrFail(int $id, mixed $user): Budget { - $budget = Budget::where( - [ + $budget = Budget::where([ 'id' => $id, 'user_id' => $user->id, - ] - ) + ]) ->get() ->first(); diff --git a/app/Services/Transaction/Categorize/CategorizationService.php b/app/Services/Transaction/Categorize/CategorizationService.php index 881ecff..4ca5f34 100644 --- a/app/Services/Transaction/Categorize/CategorizationService.php +++ b/app/Services/Transaction/Categorize/CategorizationService.php @@ -11,12 +11,9 @@ readonly class CategorizationService { public function __construct(private CacheAdapterInterface $cacheAdapter) - { - } + {} - /** - * @noinspection PhpUndefinedMethodInspection - */ + /** @noinspection PhpUndefinedMethodInspection */ public function getStats(): array { $categorizedPercentage = 0; diff --git a/app/Services/Transaction/Categorize/CategoryReferenceService.php b/app/Services/Transaction/Categorize/CategoryReferenceService.php index fc5924c..84828dc 100644 --- a/app/Services/Transaction/Categorize/CategoryReferenceService.php +++ b/app/Services/Transaction/Categorize/CategoryReferenceService.php @@ -17,11 +17,9 @@ public function saveReference(Transaction $transaction): ?int $requestUrl = config('egghead.save_reference_uri'); try { - $response = Http::withHeaders( - [ + $response = Http::withHeaders([ 'x-api-key' => config('egghead.api_token') - ] - )->post( + ])->post( url: $requestUrl, data: [ 'data' => [ @@ -30,7 +28,7 @@ public function saveReference(Transaction $transaction): ?int 'category' => Category::findOrFail($transaction->category_id)->toArray() ], 'params' => [] - ] + ] ); } catch (Throwable $throwable) { diff --git a/app/Services/Transaction/Categorize/TransactionCategorizeService.php b/app/Services/Transaction/Categorize/TransactionCategorizeService.php index af121ad..5e42a93 100644 --- a/app/Services/Transaction/Categorize/TransactionCategorizeService.php +++ b/app/Services/Transaction/Categorize/TransactionCategorizeService.php @@ -15,9 +15,7 @@ public function categorizeTransactions(Collection|LazyCollection|array $transact { $postData = []; foreach ($transactions as $transaction) { - /** - * @var Transaction $transaction -*/ + /** @var Transaction $transaction */ $postData[] = [ 'id' => $transaction->id, 'currency_id' => $transaction->currency, @@ -37,11 +35,9 @@ public function categorizeTransactions(Collection|LazyCollection|array $transact $requestUrl = config('egghead.base_api_url'); // @todo refactor - $response = Http::withHeaders( - [ + $response = Http::withHeaders([ 'x-api-key' => config('egghead.api_token') - ] - )->post( + ])->post( url: $requestUrl, data: $postData ); diff --git a/app/Services/Transaction/Category/CategorizeTransactionService.php b/app/Services/Transaction/Category/CategorizeTransactionService.php index 6d39754..239507b 100644 --- a/app/Services/Transaction/Category/CategorizeTransactionService.php +++ b/app/Services/Transaction/Category/CategorizeTransactionService.php @@ -13,9 +13,7 @@ class CategorizeTransactionService { - public function __construct(private readonly TransactionCategorizeService $transactionCategorizeService) - { - } + public function __construct(private readonly TransactionCategorizeService $transactionCategorizeService) {} public function categorizeTransactionsSync(Collection|LazyCollection|array $transactions): float|int { @@ -33,24 +31,20 @@ public function categorizeImportTransactions(mixed $importId): void Transaction::query() ->select('id') ->where('import_id', $importId) - ->chunk( - 100, function ($transactionsChunk) use (&$categorizationJobs) { - $transactionsIds = collect($transactionsChunk) - ->pluck('id') - ->toArray(); + ->chunk(100, function ($transactionsChunk) use (&$categorizationJobs) { + $transactionsIds = collect($transactionsChunk) + ->pluck('id') + ->toArray(); - $categorizationJobs[] = new CategorizeTransactions($transactionsIds); - } - ); + $categorizationJobs[] = new CategorizeTransactions($transactionsIds); + }); // @todo seems like there is not enough chunks generated (only few transactions are being sent) Bus::batch($categorizationJobs) ->name('Import [' . $importId . '] transactions categorization') - ->finally( - function () use ($importId) { - event(new ImportCategorizationFinished($importId)); - } - ) + ->finally(function () use ($importId) { + event(new ImportCategorizationFinished($importId)); + }) ->dispatch(); } } diff --git a/app/Services/Transaction/PersonalAccount/PersonalAccountService.php b/app/Services/Transaction/PersonalAccount/PersonalAccountService.php index c73f7b4..762ee5e 100644 --- a/app/Services/Transaction/PersonalAccount/PersonalAccountService.php +++ b/app/Services/Transaction/PersonalAccount/PersonalAccountService.php @@ -8,19 +8,16 @@ readonly class PersonalAccountService { public function __construct(private SaldoService $saldoService) - { - } + {} public function createForUser(User $user): PersonalAccount { - return PersonalAccount::firstOrCreate( - [ + return PersonalAccount::firstOrCreate([ 'user_id' => $user->id - ], [ + ], [ 'value' => $this->saldoService->calculate($user), 'user_id' => $user->id, 'name' => 'Default', - ] - ); + ]); } } diff --git a/app/Services/Transaction/PersonalAccount/SaldoService.php b/app/Services/Transaction/PersonalAccount/SaldoService.php index ca846e3..1ae7fe5 100644 --- a/app/Services/Transaction/PersonalAccount/SaldoService.php +++ b/app/Services/Transaction/PersonalAccount/SaldoService.php @@ -18,9 +18,7 @@ public function calculate(User $user): int { $saldo = 0; foreach (Transaction::whereUser($user)->baseCalculationQuery()->cursor() as $transaction) { - /** - * @var Transaction $transaction -*/ + /** @var Transaction $transaction */ if ($transaction->type === Transaction::TYPE_EXPENDITURE) { $saldo -= $transaction->{Transaction::CALCULATION_COLUMN}; } diff --git a/app/Services/Transaction/Report/ReportService.php b/app/Services/Transaction/Report/ReportService.php index ba65c71..9e9d8b7 100644 --- a/app/Services/Transaction/Report/ReportService.php +++ b/app/Services/Transaction/Report/ReportService.php @@ -14,13 +14,11 @@ readonly class ReportService { - public function __construct(private CurrencyService $currencyService) - { - } + public function __construct(private CurrencyService $currencyService) {} /** - * @param string|null $rawMonth Date in m-Y format (optional). - * @param mixed $userId + * @param string|null $rawMonth Date in m-Y format (optional). + * @param mixed $userId * @return array Report data. */ public function getPeriodicReport(?string $rawMonth, mixed $userId): array @@ -52,9 +50,7 @@ public function getAvgExpendituresByDays(User $user, Carbon $sinceDate, Carbon $ private function getMonthReport(Carbon $carbon, User $user): array { - /** - * @var MonthReport $reportTemplate -*/ + /** @var MonthReport $reportTemplate */ $reportTemplate = app(MonthReport::class); return $reportTemplate @@ -78,11 +74,9 @@ protected function getBaseTrendQuery(User $user): Builder { return Transaction::whereUser($user) ->baseCalculationQuery() - ->select( - DB::raw('transaction_date'), + ->select(DB::raw('transaction_date'), DB::raw('SUM(calculation_volume) as daily_sum'), - DB::raw('AVG(SUM(calculation_volume)) OVER (ORDER BY transaction_date ASC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) as average_volume') - ) + DB::raw('AVG(SUM(calculation_volume)) OVER (ORDER BY transaction_date ASC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) as average_volume')) ->groupBy('transaction_date') ->orderBy('transaction_date', 'ASC'); } diff --git a/app/Services/Transaction/Settings/UserSettingsService.php b/app/Services/Transaction/Settings/UserSettingsService.php index 01060e5..230fe1f 100644 --- a/app/Services/Transaction/Settings/UserSettingsService.php +++ b/app/Services/Transaction/Settings/UserSettingsService.php @@ -9,11 +9,9 @@ class UserSettingsService { public function assureUserSettings(User $user): Settings { - return Settings::firstOrCreate( - [ + return Settings::firstOrCreate([ 'user_id' => $user->id, 'base_currency_code' => config('moneypenny.base_calculation_currency') - ] - ); + ]); } } diff --git a/app/Services/Transaction/Similar/SimilarTransactionsService.php b/app/Services/Transaction/Similar/SimilarTransactionsService.php index a428658..4af2f4c 100644 --- a/app/Services/Transaction/Similar/SimilarTransactionsService.php +++ b/app/Services/Transaction/Similar/SimilarTransactionsService.php @@ -15,9 +15,7 @@ public function getSimilarTransactions(Transaction $transaction): Collection $baseQueryClone = clone $baseQuery; - /** - * @var Collection $baseQueryResult -*/ + /** @var Collection $baseQueryResult */ $baseQueryResult = $baseQueryClone->get(); if ($baseQueryResult->count() < 5) { @@ -71,9 +69,8 @@ private function improveSearchQueryWithToken(Transaction $transaction, Builder $ $baseQueryClone ->orWhereRaw('UPPER(description) LIKE ?', ['%' . $onlyLettersToken . '%']) - ->when( - $transaction->category, fn(Builder $builder) => $builder - ->orWhere('category_id', $transaction->category?->id) + ->when($transaction->category, fn(Builder $builder) => $builder + ->orWhere('category_id', $transaction->category?->id) ); } } diff --git a/app/Services/Transaction/Synchronization/SynchronizationService.php b/app/Services/Transaction/Synchronization/SynchronizationService.php index 931f01a..0ace4ab 100644 --- a/app/Services/Transaction/Synchronization/SynchronizationService.php +++ b/app/Services/Transaction/Synchronization/SynchronizationService.php @@ -15,9 +15,7 @@ readonly class SynchronizationService { - public function __construct(private NotificationBroadcastService $notificationBroadcastService) - { - } + public function __construct(private NotificationBroadcastService $notificationBroadcastService) {} public function all(User $user): Collection { @@ -109,9 +107,7 @@ public function handlePeriodicSynchronization(): void ->get() ->first(); - /** - * @var Carbon $carbon -*/ + /** @var Carbon $carbon */ $carbon = $lastSuccessfulSync->created_at; if (now()->diffInHours($carbon) > 4) { diff --git a/app/Services/Transaction/TransactionPersonaService.php b/app/Services/Transaction/TransactionPersonaService.php index 203e260..b6941e2 100644 --- a/app/Services/Transaction/TransactionPersonaService.php +++ b/app/Services/Transaction/TransactionPersonaService.php @@ -13,9 +13,7 @@ class TransactionPersonaService public const ACCEPTED_SIMILARITY_PERCENTAGE = 10; - /** - * @noinspection PhpUndefinedMethodInspection - */ + /** @noinspection PhpUndefinedMethodInspection */ public function createPersonasAssociations(Transaction $transaction): void { $transactionId = $transaction->id; @@ -33,12 +31,10 @@ public function createPersonasAssociations(Transaction $transaction): void $senderAssociatedPersona = $this->findOrCreateAssociation($senderSearchColumnData, $senderAccountNumber); $receiverAssociatedPersona = $this->findOrCreateAssociation($receiverSearchColumnData, $receiverAccountNumber); - Transaction::where('id', $transactionId)->update( - [ + Transaction::where('id', $transactionId)->update([ 'sender_persona_id' => $senderAssociatedPersona->id, 'receiver_persona_id' => $receiverAssociatedPersona->id - ] - ); + ]); } protected function findOrCreateAssociation(?string $personaName, ?string $personaAccountNumber): Persona @@ -59,13 +55,11 @@ protected function findOrCreateAssociation(?string $personaName, ?string $person $associatedNamesDataEncoded = json_encode($associatedNamesData); - $persona = Persona::create( - [ + $persona = Persona::create([ 'common_name' => $commonName ?? Persona::NAME_UNKNOWN, 'account_number' => $personaAccountNumber ?? Persona::ACCOUNT_NUMBER_UNKNOWN, 'associated_names' => $associatedNamesDataEncoded - ] - ); + ]); } return $persona; @@ -105,9 +99,7 @@ protected function getPersonaAccountNumberSearchRules(): array ]; } - /** - * @noinspection PhpUndefinedMethodInspection - */ + /** @noinspection PhpUndefinedMethodInspection */ protected function findPersonaByExactlySameName(string $personaName): ?Persona { $value = $this->getStringNormalizedForAssociation($personaName); @@ -128,9 +120,7 @@ protected function getStringNormalizedForAssociation(string $string): string return StringHelper::removeAccents($string); } - /** - * @noinspection PhpUndefinedMethodInspection - */ + /** @noinspection PhpUndefinedMethodInspection */ protected function findPersonaByAvgAssociatedNamesSimilarity(string $personaName): ?Persona { $personaName = $this->getStringNormalizedForAssociation($personaName); @@ -139,28 +129,26 @@ protected function findPersonaByAvgAssociatedNamesSimilarity(string $personaName $personasContainingLongestWordCursor = Persona::where('associated_names', 'like', '%' . $longestWord . '%')->cursor(); $avgSimilarityRates = $personasContainingLongestWordCursor - ->map( - function (Persona $persona) use ($personaName) { - $associatedNames = json_decode($persona->associated_names); - $similarityPercentageRates = []; + ->map(function (Persona $persona) use ($personaName) { + $associatedNames = json_decode($persona->associated_names); + $similarityPercentageRates = []; - foreach ($associatedNames as $associatedName) { - similar_text($associatedName, $personaName, $percentage); - $similarityPercentageRates[] = $percentage; - } + foreach ($associatedNames as $associatedName) { + similar_text($associatedName, $personaName, $percentage); + $similarityPercentageRates[] = $percentage; + } - $averageSimilarity = array_sum($similarityPercentageRates) / count($similarityPercentageRates); + $averageSimilarity = array_sum($similarityPercentageRates) / count($similarityPercentageRates); - if ($averageSimilarity < self::ACCEPTED_SIMILARITY_PERCENTAGE) { - return null; - } + if ($averageSimilarity < self::ACCEPTED_SIMILARITY_PERCENTAGE) { + return null; + } - return [ + return [ 'persona' => $persona, 'avg_similarity_rate' => $averageSimilarity, - ]; - } - )->filter(); + ]; + })->filter(); $mostSimilar = null; @@ -172,9 +160,7 @@ function (Persona $persona) use ($personaName) { return $mostSimilar; } - /** - * @noinspection PhpUndefinedMethodInspection - */ + /** @noinspection PhpUndefinedMethodInspection */ protected function findPersonaByAccountNumber(string $accountNumber): ?Persona { return Persona::where('account_number', $accountNumber)->get()->first(); @@ -189,12 +175,10 @@ protected function updatePersonaNames(Persona $persona, ?string $personaName): v $associatedNames[] = $personaName; $newCommonName = $this->getNamesCommonParts($associatedNames, $personaName); - $persona->update( - [ + $persona->update([ 'associated_names' => $associatedNames, 'common_name' => $newCommonName - ] - ); + ]); } } diff --git a/app/Services/Transaction/TransactionService.php b/app/Services/Transaction/TransactionService.php index 7e871c6..9fb3178 100644 --- a/app/Services/Transaction/TransactionService.php +++ b/app/Services/Transaction/TransactionService.php @@ -14,8 +14,7 @@ class TransactionService { public function __construct(private readonly SimilarTransactionsService $similarTransactionsService) - { - } + {} public function getIndexData(Filter $filter, User $user): array { @@ -46,9 +45,7 @@ public function findOrFail(mixed $id, User $user): ?Transaction 'receiverPersona', ]; - /** - * @var Transaction $transaction -*/ + /** @var Transaction $transaction */ $transaction = Transaction::with($relationsToLoad)->findOrFail($id); if ($transaction->user_id !== $user->id) { diff --git a/app/Services/Transaction/Transformers/DateGroupByToCalendar.php b/app/Services/Transaction/Transformers/DateGroupByToCalendar.php index dfe549b..79997c1 100644 --- a/app/Services/Transaction/Transformers/DateGroupByToCalendar.php +++ b/app/Services/Transaction/Transformers/DateGroupByToCalendar.php @@ -11,9 +11,7 @@ class DateGroupByToCalendar extends Transformer public static function transform(mixed $data, string $dateKey, string $valueKey): Collection { // @todo - refactor - /** - * @var Collection $data -*/ + /** @var Collection $data */ $datesData = $data->toArray(); $result = collect(); @@ -50,28 +48,24 @@ public static function transform(mixed $data, string $dateKey, string $valueKey) } } - $result->push( - [ + $result->push([ 'date' => $dayString, 'total' => $valueData - ] - ); + ]); } // @todo ASAP - rm this hack - return $result->map( - function ($record, $ix) use ($result) { - $total = data_get($record, 'total'); - if ($total <= 0) { - $nextIx = intval($ix) + 3; - $nextRecord = $result->get($nextIx); - if ($nextRecord) { - $nextTotal = data_get($nextRecord, 'total'); - $record['total'] = $nextTotal; - } + return $result->map(function($record, $ix) use ($result) { + $total = data_get($record, 'total'); + if ($total <= 0) { + $nextIx = intval($ix) + 3; + $nextRecord = $result->get($nextIx); + if ($nextRecord) { + $nextTotal = data_get($nextRecord, 'total'); + $record['total'] = $nextTotal; } - return $record; } - ); + return $record; + }); } } diff --git a/composer.json b/composer.json index 05be46d..ba9f293 100644 --- a/composer.json +++ b/composer.json @@ -36,8 +36,7 @@ "nunomaduro/collision": "^7.0", "nunomaduro/larastan": "^2.0", "phpunit/phpunit": "^10.0", - "spatie/laravel-ignition": "^2.0", - "squizlabs/php_codesniffer": "^3.8" + "spatie/laravel-ignition": "^2.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index bc25f56..d370793 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "cf3bea42dea3c96e95bd362f16a4fcd3", + "content-hash": "4642aadedca03b800a684db3c2674f6d", "packages": [ { "name": "barryvdh/laravel-debugbar", @@ -10718,86 +10718,6 @@ ], "time": "2023-08-23T06:24:34+00:00" }, - { - "name": "squizlabs/php_codesniffer", - "version": "3.8.0", - "source": { - "type": "git", - "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5805f7a4e4958dbb5e944ef1e6edae0a303765e7", - "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" - }, - "bin": [ - "bin/phpcs", - "bin/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "Former lead" - }, - { - "name": "Juliette Reinders Folmer", - "role": "Current lead" - }, - { - "name": "Contributors", - "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", - "keywords": [ - "phpcs", - "standards", - "static analysis" - ], - "support": { - "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", - "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", - "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", - "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" - }, - "funding": [ - { - "url": "https://github.com/PHPCSStandards", - "type": "github" - }, - { - "url": "https://github.com/jrfnl", - "type": "github" - }, - { - "url": "https://opencollective.com/php_codesniffer", - "type": "open_collective" - } - ], - "time": "2023-12-08T12:32:31+00:00" - }, { "name": "symfony/yaml", "version": "v6.3.3", @@ -10927,8 +10847,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^8.2", - "ext-pdo": "*" + "php": "^8.2" }, "platform-dev": [], "plugin-api-version": "2.6.0" diff --git a/config/app.php b/config/app.php index 006e355..9513108 100644 --- a/config/app.php +++ b/config/app.php @@ -217,10 +217,8 @@ | */ - 'aliases' => Facade::defaultAliases()->merge( - [ + 'aliases' => Facade::defaultAliases()->merge([ // 'ExampleClass' => App\Example\ExampleClass::class, - ] - )->toArray(), + ])->toArray(), ]; diff --git a/config/database.php b/config/database.php index fb6dab5..7d445ae 100644 --- a/config/database.php +++ b/config/database.php @@ -58,11 +58,9 @@ 'prefix_indexes' => true, 'strict' => true, 'engine' => null, - 'options' => extension_loaded('pdo_mysql') ? array_filter( - [ + 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), - ] - ) : [], + ]) : [], ], 'mysql_testing' => [ diff --git a/config/sanctum.php b/config/sanctum.php index 1963d4e..3e7a54e 100644 --- a/config/sanctum.php +++ b/config/sanctum.php @@ -15,15 +15,11 @@ | */ - 'stateful' => explode( - ',', env( - 'SANCTUM_STATEFUL_DOMAINS', sprintf( - '%s%s', - 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1,localhost:80,http://localhost:80', - Sanctum::currentApplicationUrlWithPort() - ) - ) - ), + 'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( + '%s%s', + 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1,localhost:80,http://localhost:80', + Sanctum::currentApplicationUrlWithPort() + ))), /* |-------------------------------------------------------------------------- diff --git a/database/factories/Import/ImportFactory.php b/database/factories/Import/ImportFactory.php index 523fdd6..c2a1014 100644 --- a/database/factories/Import/ImportFactory.php +++ b/database/factories/Import/ImportFactory.php @@ -20,15 +20,13 @@ class ImportFactory extends Factory */ public function definition(): array { - $randomStatus = $this->faker->randomElement( - [ + $randomStatus = $this->faker->randomElement([ Import::STATUS_SAVED, Import::STATUS_IMPORTED, Import::STATUS_IMPORTING, Import::STATUS_PROCESSING, Import::STATUS_IMPORT_ERROR - ] - ); + ]); return [ 'status' => $randomStatus, diff --git a/database/factories/Transaction/TransactionFactory.php b/database/factories/Transaction/TransactionFactory.php index e010de9..b6f4e2f 100644 --- a/database/factories/Transaction/TransactionFactory.php +++ b/database/factories/Transaction/TransactionFactory.php @@ -17,12 +17,10 @@ public function definition(): array 2 ); - $type = $this->faker->randomElement( - [ + $type = $this->faker->randomElement([ Transaction::TYPE_INCOME, Transaction::TYPE_EXPENDITURE - ] - ); + ]); return [ 'is_excluded_from_calculation' => $this->faker->boolean(), diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 11f3064..38fb906 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -31,11 +31,9 @@ public function definition(): array */ public function unverified(): static { - return $this->state( - fn (array $attributes) => [ + return $this->state(fn (array $attributes) => [ 'email_verified_at' => null, - ] - ); + ]); } /** @@ -43,10 +41,8 @@ public function unverified(): static */ public function admin(): static { - return $this->state( - fn (array $attributes) => [ + return $this->state(fn (array $attributes) => [ 'is_admin' => true, - ] - ); + ]); } } diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 4cee33c..444fafb 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -11,17 +11,15 @@ */ public function up(): void { - Schema::create( - 'users', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table->string('email')->unique(); - $table->timestamp('email_verified_at')->nullable(); - $table->string('password'); - $table->rememberToken(); - $table->timestamps(); - } - ); + Schema::create('users', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table->string('email')->unique(); + $table->timestamp('email_verified_at')->nullable(); + $table->string('password'); + $table->rememberToken(); + $table->timestamps(); + }); } /** diff --git a/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php b/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php index 827bf90..81a7229 100644 --- a/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php +++ b/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php @@ -11,13 +11,11 @@ */ public function up(): void { - Schema::create( - 'password_reset_tokens', function (Blueprint $table) { - $table->string('email')->primary(); - $table->string('token'); - $table->timestamp('created_at')->nullable(); - } - ); + Schema::create('password_reset_tokens', function (Blueprint $table) { + $table->string('email')->primary(); + $table->string('token'); + $table->timestamp('created_at')->nullable(); + }); } /** diff --git a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php index 81a495d..249da81 100644 --- a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php +++ b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php @@ -11,17 +11,15 @@ */ public function up(): void { - Schema::create( - 'failed_jobs', function (Blueprint $table) { - $table->id(); - $table->string('uuid')->unique(); - $table->text('connection'); - $table->text('queue'); - $table->longText('payload'); - $table->longText('exception'); - $table->timestamp('failed_at')->useCurrent(); - } - ); + Schema::create('failed_jobs', function (Blueprint $table) { + $table->id(); + $table->string('uuid')->unique(); + $table->text('connection'); + $table->text('queue'); + $table->longText('payload'); + $table->longText('exception'); + $table->timestamp('failed_at')->useCurrent(); + }); } /** diff --git a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php index 83e2066..e828ad8 100644 --- a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php +++ b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php @@ -11,18 +11,16 @@ */ public function up(): void { - Schema::create( - 'personal_access_tokens', function (Blueprint $table) { - $table->id(); - $table->morphs('tokenable'); - $table->string('name'); - $table->string('token', 64)->unique(); - $table->text('abilities')->nullable(); - $table->timestamp('last_used_at')->nullable(); - $table->timestamp('expires_at')->nullable(); - $table->timestamps(); - } - ); + Schema::create('personal_access_tokens', function (Blueprint $table) { + $table->id(); + $table->morphs('tokenable'); + $table->string('name'); + $table->string('token', 64)->unique(); + $table->text('abilities')->nullable(); + $table->timestamp('last_used_at')->nullable(); + $table->timestamp('expires_at')->nullable(); + $table->timestamps(); + }); } /** diff --git a/database/migrations/2023_04_06_210329_create_import_settings_table.php b/database/migrations/2023_04_06_210329_create_import_settings_table.php index d4459d9..b00abd2 100644 --- a/database/migrations/2023_04_06_210329_create_import_settings_table.php +++ b/database/migrations/2023_04_06_210329_create_import_settings_table.php @@ -11,19 +11,17 @@ */ public function up(): void { - Schema::create( - 'import_settings', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table->unsignedTinyInteger('start_row'); - $table->string('file_extension'); - $table->string('delimiter'); - $table->string('enclosure')->nullable(); - $table->string('escape_character')->nullable(); - $table->string('input_encoding')->nullable(); - $table->timestamps(); - } - ); + Schema::create('import_settings', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table->unsignedTinyInteger('start_row'); + $table->string('file_extension'); + $table->string('delimiter'); + $table->string('enclosure')->nullable(); + $table->string('escape_character')->nullable(); + $table->string('input_encoding')->nullable(); + $table->timestamps(); + }); } /** diff --git a/database/migrations/2023_04_06_210330_create_files_table.php b/database/migrations/2023_04_06_210330_create_files_table.php index 91079cd..81421b8 100644 --- a/database/migrations/2023_04_06_210330_create_files_table.php +++ b/database/migrations/2023_04_06_210330_create_files_table.php @@ -11,20 +11,18 @@ */ public function up(): void { - Schema::create( - 'files', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table->string('path'); - $table->integer('size'); - $table - ->foreignId('import_setting_id') - ->nullable() - ->constrained('import_settings') - ->nullOnDelete(); - $table->timestamps(); - } - ); + Schema::create('files', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table->string('path'); + $table->integer('size'); + $table + ->foreignId('import_setting_id') + ->nullable() + ->constrained('import_settings') + ->nullOnDelete(); + $table->timestamps(); + }); } /** diff --git a/database/migrations/2023_04_07_113635_create_columns_mappings_table.php b/database/migrations/2023_04_07_113635_create_columns_mappings_table.php index f8dd369..119812d 100644 --- a/database/migrations/2023_04_07_113635_create_columns_mappings_table.php +++ b/database/migrations/2023_04_07_113635_create_columns_mappings_table.php @@ -11,20 +11,18 @@ */ public function up(): void { - Schema::create( - 'columns_mappings', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table->unsignedSmallInteger('transaction_date_column_index')->nullable(); - $table->unsignedSmallInteger('accounting_date_column_index')->nullable(); - $table->unsignedSmallInteger('volume_column_index')->nullable(); - $table->unsignedSmallInteger('sender_column_index')->nullable(); - $table->unsignedSmallInteger('receiver_column_index')->nullable(); - $table->unsignedSmallInteger('description_column_index')->nullable(); - $table->unsignedSmallInteger('currency_column_index')->nullable(); - $table->timestamps(); - } - ); + Schema::create('columns_mappings', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table->unsignedSmallInteger('transaction_date_column_index')->nullable(); + $table->unsignedSmallInteger('accounting_date_column_index')->nullable(); + $table->unsignedSmallInteger('volume_column_index')->nullable(); + $table->unsignedSmallInteger('sender_column_index')->nullable(); + $table->unsignedSmallInteger('receiver_column_index')->nullable(); + $table->unsignedSmallInteger('description_column_index')->nullable(); + $table->unsignedSmallInteger('currency_column_index')->nullable(); + $table->timestamps(); + }); } /** diff --git a/database/migrations/2023_04_07_113636_create_imports_table.php b/database/migrations/2023_04_07_113636_create_imports_table.php index 6afd003..d854a77 100644 --- a/database/migrations/2023_04_07_113636_create_imports_table.php +++ b/database/migrations/2023_04_07_113636_create_imports_table.php @@ -11,28 +11,26 @@ */ public function up(): void { - Schema::create( - 'imports', function (Blueprint $table) { - $table->id(); - $table->tinyInteger('status'); - $table - ->foreignId('import_setting_id') - ->nullable() - ->constrained('import_settings') - ->nullOnDelete(); - $table - ->foreignId('columns_mapping_id') - ->nullable() - ->constrained('columns_mappings') - ->nullOnDelete(); - $table - ->foreignId('file_id') - ->nullable() - ->constrained('files') - ->nullOnDelete(); - $table->timestamps(); - } - ); + Schema::create('imports', function (Blueprint $table) { + $table->id(); + $table->tinyInteger('status'); + $table + ->foreignId('import_setting_id') + ->nullable() + ->constrained('import_settings') + ->nullOnDelete(); + $table + ->foreignId('columns_mapping_id') + ->nullable() + ->constrained('columns_mappings') + ->nullOnDelete(); + $table + ->foreignId('file_id') + ->nullable() + ->constrained('files') + ->nullOnDelete(); + $table->timestamps(); + }); } /** diff --git a/database/migrations/2023_04_07_134640_create_transactions_table.php b/database/migrations/2023_04_07_134640_create_transactions_table.php index 34c7bc0..47f2646 100644 --- a/database/migrations/2023_04_07_134640_create_transactions_table.php +++ b/database/migrations/2023_04_07_134640_create_transactions_table.php @@ -11,28 +11,26 @@ */ public function up(): void { - Schema::create( - 'transactions', function (Blueprint $table) { - $table->id(); - $table->date('transaction_date')->nullable(); - $table->date('accounting_date')->nullable(); - $table->string('sender')->nullable(); - $table->string('raw_volume')->nullable(); - $table->decimal('decimal_volume')->nullable(); - $table - ->unsignedTinyInteger('type') - ->default(Transaction::TYPE_UNKNOWN) - ->nullable(); - $table->string('receiver')->nullable(); - $table->text('description')->nullable(); - $table->string('currency')->nullable(); - $table - ->foreignId('import_id') - ->constrained('imports') - ->cascadeOnDelete(); - $table->timestamps(); - } - ); + Schema::create('transactions', function (Blueprint $table) { + $table->id(); + $table->date('transaction_date')->nullable(); + $table->date('accounting_date')->nullable(); + $table->string('sender')->nullable(); + $table->string('raw_volume')->nullable(); + $table->decimal('decimal_volume')->nullable(); + $table + ->unsignedTinyInteger('type') + ->default(Transaction::TYPE_UNKNOWN) + ->nullable(); + $table->string('receiver')->nullable(); + $table->text('description')->nullable(); + $table->string('currency')->nullable(); + $table + ->foreignId('import_id') + ->constrained('imports') + ->cascadeOnDelete(); + $table->timestamps(); + }); } /** diff --git a/database/migrations/2023_04_09_154834_create_nordigen_end_user_agreements_table.php b/database/migrations/2023_04_09_154834_create_nordigen_end_user_agreements_table.php index 1dac9d2..0cba7f6 100644 --- a/database/migrations/2023_04_09_154834_create_nordigen_end_user_agreements_table.php +++ b/database/migrations/2023_04_09_154834_create_nordigen_end_user_agreements_table.php @@ -11,18 +11,16 @@ */ public function up(): void { - Schema::create( - 'nordigen_end_user_agreements', function (Blueprint $table) { - $table->id(); - $table->boolean('is_successful')->default(false); - $table->json('raw_request_body'); - $table->json('raw_response_body'); - $table->string('nordigen_institution_id')->nullable(); - $table->string('nordigen_end_user_agreement_id')->nullable(); - $table->dateTime('nordigen_end_user_agreement_created')->nullable(); - $table->timestamps(); - } - ); + Schema::create('nordigen_end_user_agreements', function (Blueprint $table) { + $table->id(); + $table->boolean('is_successful')->default(false); + $table->json('raw_request_body'); + $table->json('raw_response_body'); + $table->string('nordigen_institution_id')->nullable(); + $table->string('nordigen_end_user_agreement_id')->nullable(); + $table->dateTime('nordigen_end_user_agreement_created')->nullable(); + $table->timestamps(); + }); } /** diff --git a/database/migrations/2023_04_09_170907_create_nordigen_requisitions_table.php b/database/migrations/2023_04_09_170907_create_nordigen_requisitions_table.php index 588d1a9..f79a794 100644 --- a/database/migrations/2023_04_09_170907_create_nordigen_requisitions_table.php +++ b/database/migrations/2023_04_09_170907_create_nordigen_requisitions_table.php @@ -11,23 +11,21 @@ */ public function up(): void { - Schema::create( - 'nordigen_requisitions', function (Blueprint $table) { - $table->id(); - $table->uuid('reference'); - $table->json('raw_request_body'); - $table->json('raw_response_body'); - $table->string('link', 512); - $table->string('nordigen_institution_id'); - $table->string('nordigen_requisition_id'); - $table - ->foreignId('end_user_agreement_id') - ->references('id') - ->on('nordigen_end_user_agreements') - ->cascadeOnDelete(); - $table->timestamps(); - } - ); + Schema::create('nordigen_requisitions', function (Blueprint $table) { + $table->id(); + $table->uuid('reference'); + $table->json('raw_request_body'); + $table->json('raw_response_body'); + $table->string('link', 512); + $table->string('nordigen_institution_id'); + $table->string('nordigen_requisition_id'); + $table + ->foreignId('end_user_agreement_id') + ->references('id') + ->on('nordigen_end_user_agreements') + ->cascadeOnDelete(); + $table->timestamps(); + }); } /** diff --git a/database/migrations/2023_04_10_225503_create_synchronizations_table.php b/database/migrations/2023_04_10_225503_create_synchronizations_table.php index d2eb515..9ccf9cc 100644 --- a/database/migrations/2023_04_10_225503_create_synchronizations_table.php +++ b/database/migrations/2023_04_10_225503_create_synchronizations_table.php @@ -11,12 +11,10 @@ */ public function up(): void { - Schema::create( - 'synchronizations', function (Blueprint $table) { - $table->id(); - $table->timestamps(); - } - ); + Schema::create('synchronizations', function (Blueprint $table) { + $table->id(); + $table->timestamps(); + }); } /** diff --git a/database/migrations/2023_04_10_225930_create_accounts_table.php b/database/migrations/2023_04_10_225930_create_accounts_table.php index 3603165..c80dd79 100644 --- a/database/migrations/2023_04_10_225930_create_accounts_table.php +++ b/database/migrations/2023_04_10_225930_create_accounts_table.php @@ -11,13 +11,11 @@ */ public function up(): void { - Schema::create( - 'accounts', function (Blueprint $table) { - $table->id(); - $table->string('nordigen_account_id'); - $table->timestamps(); - } - ); + Schema::create('accounts', function (Blueprint $table) { + $table->id(); + $table->string('nordigen_account_id'); + $table->timestamps(); + }); } /** diff --git a/database/migrations/2023_04_10_230033_create_personal_accounts_table.php b/database/migrations/2023_04_10_230033_create_personal_accounts_table.php index 1f7576d..1a44e8a 100644 --- a/database/migrations/2023_04_10_230033_create_personal_accounts_table.php +++ b/database/migrations/2023_04_10_230033_create_personal_accounts_table.php @@ -11,18 +11,16 @@ */ public function up(): void { - Schema::create( - 'personal_accounts', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table->decimal('value', 9)->nullable(); - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - $table->timestamps(); - } - ); + Schema::create('personal_accounts', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table->decimal('value', 9)->nullable(); + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + $table->timestamps(); + }); } /** diff --git a/database/migrations/2023_04_10_230034_add_personal_account_id_to_transactions_table.php b/database/migrations/2023_04_10_230034_add_personal_account_id_to_transactions_table.php index b1bc7b4..98ee58a 100644 --- a/database/migrations/2023_04_10_230034_add_personal_account_id_to_transactions_table.php +++ b/database/migrations/2023_04_10_230034_add_personal_account_id_to_transactions_table.php @@ -11,15 +11,13 @@ */ public function up(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table - ->foreignId('personal_account_id') - ->nullable() - ->constrained('personal_accounts') - ->cascadeOnDelete(); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table + ->foreignId('personal_account_id') + ->nullable() + ->constrained('personal_accounts') + ->cascadeOnDelete(); + }); } /** @@ -27,10 +25,8 @@ public function up(): void */ public function down(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table->dropColumn('personal_account_id'); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table->dropColumn('personal_account_id'); + }); } }; diff --git a/database/migrations/2023_04_11_000852_make_import_id_nullable_at_transactions_table.php b/database/migrations/2023_04_11_000852_make_import_id_nullable_at_transactions_table.php index 3c5f7db..5885f2a 100644 --- a/database/migrations/2023_04_11_000852_make_import_id_nullable_at_transactions_table.php +++ b/database/migrations/2023_04_11_000852_make_import_id_nullable_at_transactions_table.php @@ -11,14 +11,12 @@ */ public function up(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table - ->foreignId('import_id') - ->nullable() - ->change(); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table + ->foreignId('import_id') + ->nullable() + ->change(); + }); } /** @@ -26,13 +24,11 @@ public function up(): void */ public function down(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table - ->foreignId('import_id') - ->nullable(false) - ->change(); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table + ->foreignId('import_id') + ->nullable(false) + ->change(); + }); } }; diff --git a/database/migrations/2023_04_11_002309_add_synchronization_id_column_to_accounts.php b/database/migrations/2023_04_11_002309_add_synchronization_id_column_to_accounts.php index 60f2556..4431e99 100644 --- a/database/migrations/2023_04_11_002309_add_synchronization_id_column_to_accounts.php +++ b/database/migrations/2023_04_11_002309_add_synchronization_id_column_to_accounts.php @@ -11,15 +11,13 @@ */ public function up(): void { - Schema::table( - 'accounts', function (Blueprint $table) { - $table - ->foreignId('synchronization_id') - ->nullable() - ->constrained('synchronizations') - ->cascadeOnDelete(); - } - ); + Schema::table('accounts', function (Blueprint $table) { + $table + ->foreignId('synchronization_id') + ->nullable() + ->constrained('synchronizations') + ->cascadeOnDelete(); + }); } /** @@ -27,10 +25,8 @@ public function up(): void */ public function down(): void { - Schema::table( - 'accounts', function (Blueprint $table) { - $table->dropColumn('synchronization_id'); - } - ); + Schema::table('accounts', function (Blueprint $table) { + $table->dropColumn('synchronization_id'); + }); } }; diff --git a/database/migrations/2023_04_11_104023_add_status_column_to_synchronizations.php b/database/migrations/2023_04_11_104023_add_status_column_to_synchronizations.php index 1b2aa76..9584561 100644 --- a/database/migrations/2023_04_11_104023_add_status_column_to_synchronizations.php +++ b/database/migrations/2023_04_11_104023_add_status_column_to_synchronizations.php @@ -12,13 +12,11 @@ */ public function up(): void { - Schema::table( - 'synchronizations', function (Blueprint $table) { - $table - ->tinyInteger('status') - ->default(Synchronization::SYNC_STATUS_RUNNING); - } - ); + Schema::table('synchronizations', function (Blueprint $table) { + $table + ->tinyInteger('status') + ->default(Synchronization::SYNC_STATUS_RUNNING); + }); } /** @@ -26,10 +24,8 @@ public function up(): void */ public function down(): void { - Schema::table( - 'synchronizations', function (Blueprint $table) { - $table->dropColumn('status'); - } - ); + Schema::table('synchronizations', function (Blueprint $table) { + $table->dropColumn('status'); + }); } }; diff --git a/database/migrations/2023_04_13_115538_create_exchange_rates_table.php b/database/migrations/2023_04_13_115538_create_exchange_rates_table.php index 99df2d9..59869b2 100644 --- a/database/migrations/2023_04_13_115538_create_exchange_rates_table.php +++ b/database/migrations/2023_04_13_115538_create_exchange_rates_table.php @@ -11,15 +11,13 @@ */ public function up(): void { - Schema::create( - 'exchange_rates', function (Blueprint $table) { - $table->id(); - $table->string('base_currency'); - $table->string('target_currency'); - $table->date('rate_source_date'); - $table->timestamps(); - } - ); + Schema::create('exchange_rates', function (Blueprint $table) { + $table->id(); + $table->string('base_currency'); + $table->string('target_currency'); + $table->date('rate_source_date'); + $table->timestamps(); + }); } /** diff --git a/database/migrations/2023_04_13_123017_add_rate_to_exchange_rates.php b/database/migrations/2023_04_13_123017_add_rate_to_exchange_rates.php index 8861c4a..d0545e4 100644 --- a/database/migrations/2023_04_13_123017_add_rate_to_exchange_rates.php +++ b/database/migrations/2023_04_13_123017_add_rate_to_exchange_rates.php @@ -11,11 +11,9 @@ */ public function up(): void { - Schema::table( - 'exchange_rates', function (Blueprint $table) { - $table->decimal('rate', 16, 6); - } - ); + Schema::table('exchange_rates', function (Blueprint $table) { + $table->decimal('rate', 16, 6); + }); } /** @@ -23,10 +21,8 @@ public function up(): void */ public function down(): void { - Schema::table( - 'exchange_rates', function (Blueprint $table) { - $table->dropColumn('rate'); - } - ); + Schema::table('exchange_rates', function (Blueprint $table) { + $table->dropColumn('rate'); + }); } }; diff --git a/database/migrations/2023_04_13_132206_add_calculation_volume_to_transactions.php b/database/migrations/2023_04_13_132206_add_calculation_volume_to_transactions.php index 031301c..0414816 100644 --- a/database/migrations/2023_04_13_132206_add_calculation_volume_to_transactions.php +++ b/database/migrations/2023_04_13_132206_add_calculation_volume_to_transactions.php @@ -11,11 +11,9 @@ */ public function up(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table->decimal('calculation_volume', 9)->nullable(); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table->decimal('calculation_volume', 9)->nullable(); + }); } /** @@ -23,10 +21,8 @@ public function up(): void */ public function down(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table->dropColumn('calculation_volume'); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table->dropColumn('calculation_volume'); + }); } }; diff --git a/database/migrations/2023_04_22_155233_add_synchronization_id_to_imports.php b/database/migrations/2023_04_22_155233_add_synchronization_id_to_imports.php index b1eccb6..e691008 100644 --- a/database/migrations/2023_04_22_155233_add_synchronization_id_to_imports.php +++ b/database/migrations/2023_04_22_155233_add_synchronization_id_to_imports.php @@ -11,15 +11,13 @@ */ public function up(): void { - Schema::table( - 'imports', function (Blueprint $table) { - $table - ->foreignId('synchronization_id') - ->nullable() - ->constrained('synchronizations') - ->nullOnDelete(); - } - ); + Schema::table('imports', function (Blueprint $table) { + $table + ->foreignId('synchronization_id') + ->nullable() + ->constrained('synchronizations') + ->nullOnDelete(); + }); } /** @@ -27,10 +25,8 @@ public function up(): void */ public function down(): void { - Schema::table( - 'imports', function (Blueprint $table) { - $table->dropColumn('synchronization_id'); - } - ); + Schema::table('imports', function (Blueprint $table) { + $table->dropColumn('synchronization_id'); + }); } }; diff --git a/database/migrations/2023_04_22_155257_make_file_id_column_nullable_at_imports.php b/database/migrations/2023_04_22_155257_make_file_id_column_nullable_at_imports.php index 116b042..00cf0c5 100644 --- a/database/migrations/2023_04_22_155257_make_file_id_column_nullable_at_imports.php +++ b/database/migrations/2023_04_22_155257_make_file_id_column_nullable_at_imports.php @@ -11,14 +11,12 @@ */ public function up(): void { - Schema::table( - 'imports', function (Blueprint $table) { - $table - ->foreignId('file_id') - ->nullable() - ->change(); - } - ); + Schema::table('imports', function (Blueprint $table) { + $table + ->foreignId('file_id') + ->nullable() + ->change(); + }); } /** @@ -26,13 +24,11 @@ public function up(): void */ public function down(): void { - Schema::table( - 'imports', function (Blueprint $table) { - $table - ->foreignId('file_id') - ->nullable(false) - ->change(); - } - ); + Schema::table('imports', function (Blueprint $table) { + $table + ->foreignId('file_id') + ->nullable(false) + ->change(); + }); } }; diff --git a/database/migrations/2023_04_22_161039_add_transactions_statistics_columns_to_imports.php b/database/migrations/2023_04_22_161039_add_transactions_statistics_columns_to_imports.php index 790c718..85d0405 100644 --- a/database/migrations/2023_04_22_161039_add_transactions_statistics_columns_to_imports.php +++ b/database/migrations/2023_04_22_161039_add_transactions_statistics_columns_to_imports.php @@ -11,11 +11,9 @@ */ public function up(): void { - Schema::table( - 'imports', function (Blueprint $table) { - $table->unsignedInteger('transactions_skipped_count')->default(0); - } - ); + Schema::table('imports', function (Blueprint $table) { + $table->unsignedInteger('transactions_skipped_count')->default(0); + }); } /** @@ -23,10 +21,8 @@ public function up(): void */ public function down(): void { - Schema::table( - 'imports', function (Blueprint $table) { - $table->dropColumn('transactions_skipped_count'); - } - ); + Schema::table('imports', function (Blueprint $table) { + $table->dropColumn('transactions_skipped_count'); + }); } }; diff --git a/database/migrations/2023_04_22_164514_make_columns_nullable_at_imports.php b/database/migrations/2023_04_22_164514_make_columns_nullable_at_imports.php index 5c8a5f6..2ae8a5f 100644 --- a/database/migrations/2023_04_22_164514_make_columns_nullable_at_imports.php +++ b/database/migrations/2023_04_22_164514_make_columns_nullable_at_imports.php @@ -11,12 +11,10 @@ */ public function up(): void { - Schema::table( - 'imports', function (Blueprint $table) { - $table->foreignId('import_setting_id')->nullable()->change(); - $table->foreignId('columns_mapping_id')->nullable()->change(); - } - ); + Schema::table('imports', function (Blueprint $table) { + $table->foreignId('import_setting_id')->nullable()->change(); + $table->foreignId('columns_mapping_id')->nullable()->change(); + }); } /** @@ -24,11 +22,9 @@ public function up(): void */ public function down(): void { - Schema::table( - 'imports', function (Blueprint $table) { - $table->foreignId('import_setting_id')->nullable(false)->change(); - $table->foreignId('columns_mapping_id')->nullable(false)->change(); - } - ); + Schema::table('imports', function (Blueprint $table) { + $table->foreignId('import_setting_id')->nullable(false)->change(); + $table->foreignId('columns_mapping_id')->nullable(false)->change(); + }); } }; diff --git a/database/migrations/2023_04_27_202046_create_personas_table.php b/database/migrations/2023_04_27_202046_create_personas_table.php index f901b01..568e2e8 100644 --- a/database/migrations/2023_04_27_202046_create_personas_table.php +++ b/database/migrations/2023_04_27_202046_create_personas_table.php @@ -11,14 +11,12 @@ */ public function up(): void { - Schema::create( - 'personas', function (Blueprint $table) { - $table->id(); - $table->string('common_name'); - $table->json('associated_names'); - $table->timestamps(); - } - ); + Schema::create('personas', function (Blueprint $table) { + $table->id(); + $table->string('common_name'); + $table->json('associated_names'); + $table->timestamps(); + }); } /** diff --git a/database/migrations/2023_04_27_203334_add_personas_columns_to_transactions.php b/database/migrations/2023_04_27_203334_add_personas_columns_to_transactions.php index 442bfde..49212cf 100644 --- a/database/migrations/2023_04_27_203334_add_personas_columns_to_transactions.php +++ b/database/migrations/2023_04_27_203334_add_personas_columns_to_transactions.php @@ -11,22 +11,20 @@ */ public function up(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table - ->foreignId('sender_persona_id') - ->nullable() - ->references('id') - ->on('personas') - ->cascadeOnDelete(); - $table - ->foreignId('receiver_persona_id') - ->nullable() - ->references('id') - ->on('personas') - ->cascadeOnDelete(); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table + ->foreignId('sender_persona_id') + ->nullable() + ->references('id') + ->on('personas') + ->cascadeOnDelete(); + $table + ->foreignId('receiver_persona_id') + ->nullable() + ->references('id') + ->on('personas') + ->cascadeOnDelete(); + }); } /** @@ -34,11 +32,9 @@ public function up(): void */ public function down(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table->dropColumn('sender_persona_id'); - $table->dropColumn('receiver_persona_id'); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table->dropColumn('sender_persona_id'); + $table->dropColumn('receiver_persona_id'); + }); } }; diff --git a/database/migrations/2023_04_28_103900_add_sender_account_number_to_transactions.php b/database/migrations/2023_04_28_103900_add_sender_account_number_to_transactions.php index 080fc27..3496a0e 100644 --- a/database/migrations/2023_04_28_103900_add_sender_account_number_to_transactions.php +++ b/database/migrations/2023_04_28_103900_add_sender_account_number_to_transactions.php @@ -11,11 +11,9 @@ */ public function up(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table->string('sender_account_number', 512)->nullable(); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table->string('sender_account_number', 512)->nullable(); + }); } /** @@ -23,10 +21,8 @@ public function up(): void */ public function down(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table->dropColumn('sender_account_number'); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table->dropColumn('sender_account_number'); + }); } }; diff --git a/database/migrations/2023_04_28_103924_add_receiver_account_number_to_transactions.php b/database/migrations/2023_04_28_103924_add_receiver_account_number_to_transactions.php index 3872c40..f73a831 100644 --- a/database/migrations/2023_04_28_103924_add_receiver_account_number_to_transactions.php +++ b/database/migrations/2023_04_28_103924_add_receiver_account_number_to_transactions.php @@ -11,11 +11,9 @@ */ public function up(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table->string('receiver_account_number', 512)->nullable(); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table->string('receiver_account_number', 512)->nullable(); + }); } /** @@ -23,10 +21,8 @@ public function up(): void */ public function down(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table->dropColumn('receiver_account_number')->nullable(); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table->dropColumn('receiver_account_number')->nullable(); + }); } }; diff --git a/database/migrations/2023_04_28_103943_add_account_number_to_personas.php b/database/migrations/2023_04_28_103943_add_account_number_to_personas.php index c8b0748..517e475 100644 --- a/database/migrations/2023_04_28_103943_add_account_number_to_personas.php +++ b/database/migrations/2023_04_28_103943_add_account_number_to_personas.php @@ -11,11 +11,9 @@ */ public function up(): void { - Schema::table( - 'personas', function (Blueprint $table) { - $table->string('account_number', 512); - } - ); + Schema::table('personas', function (Blueprint $table) { + $table->string('account_number', 512); + }); } /** @@ -23,10 +21,8 @@ public function up(): void */ public function down(): void { - Schema::table( - 'personas', function (Blueprint $table) { - $table->dropColumn('account_number'); - } - ); + Schema::table('personas', function (Blueprint $table) { + $table->dropColumn('account_number'); + }); } }; diff --git a/database/migrations/2023_04_28_104434_add_sender_and_receiver_account_numbers_columns_indexes_to_columns_mappings.php b/database/migrations/2023_04_28_104434_add_sender_and_receiver_account_numbers_columns_indexes_to_columns_mappings.php index eebf5c9..4893351 100644 --- a/database/migrations/2023_04_28_104434_add_sender_and_receiver_account_numbers_columns_indexes_to_columns_mappings.php +++ b/database/migrations/2023_04_28_104434_add_sender_and_receiver_account_numbers_columns_indexes_to_columns_mappings.php @@ -11,12 +11,10 @@ */ public function up(): void { - Schema::table( - 'columns_mappings', function (Blueprint $table) { - $table->unsignedSmallInteger('sender_account_number_column_index')->nullable(); - $table->unsignedSmallInteger('receiver_account_number_column_index')->nullable(); - } - ); + Schema::table('columns_mappings', function (Blueprint $table) { + $table->unsignedSmallInteger('sender_account_number_column_index')->nullable(); + $table->unsignedSmallInteger('receiver_account_number_column_index')->nullable(); + }); } /** @@ -24,11 +22,9 @@ public function up(): void */ public function down(): void { - Schema::table( - 'columns_mappings', function (Blueprint $table) { - $table->dropColumn('sender_account_number_column_index'); - $table->dropColumn('receiver_account_number_column_index'); - } - ); + Schema::table('columns_mappings', function (Blueprint $table) { + $table->dropColumn('sender_account_number_column_index'); + $table->dropColumn('receiver_account_number_column_index'); + }); } }; diff --git a/database/migrations/2023_04_28_190306_create_reports_table.php b/database/migrations/2023_04_28_190306_create_reports_table.php index 80bc52a..e1c37af 100644 --- a/database/migrations/2023_04_28_190306_create_reports_table.php +++ b/database/migrations/2023_04_28_190306_create_reports_table.php @@ -11,13 +11,11 @@ */ public function up(): void { - Schema::create( - 'reports', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table->timestamps(); - } - ); + Schema::create('reports', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table->timestamps(); + }); } /** diff --git a/database/migrations/2023_05_02_052307_create_report_fields_table.php b/database/migrations/2023_05_02_052307_create_report_fields_table.php index 80326e6..5442ae3 100644 --- a/database/migrations/2023_05_02_052307_create_report_fields_table.php +++ b/database/migrations/2023_05_02_052307_create_report_fields_table.php @@ -11,20 +11,18 @@ */ public function up(): void { - Schema::create( - 'report_fields', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table->unsignedTinyInteger('type'); - $table->string('value')->nullable(); - $table - ->foreignId('report_id') - ->references('id') - ->on('reports') - ->cascadeOnDelete(); - $table->timestamps(); - } - ); + Schema::create('report_fields', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table->unsignedTinyInteger('type'); + $table->string('value')->nullable(); + $table + ->foreignId('report_id') + ->references('id') + ->on('reports') + ->cascadeOnDelete(); + $table->timestamps(); + }); } /** diff --git a/database/migrations/2023_05_02_052658_add_parent_report_field_id_to_report_fields.php b/database/migrations/2023_05_02_052658_add_parent_report_field_id_to_report_fields.php index 92712ba..f3c2307 100644 --- a/database/migrations/2023_05_02_052658_add_parent_report_field_id_to_report_fields.php +++ b/database/migrations/2023_05_02_052658_add_parent_report_field_id_to_report_fields.php @@ -11,16 +11,14 @@ */ public function up(): void { - Schema::table( - 'report_fields', function (Blueprint $table) { - $table - ->foreignId('parent_report_field_id') - ->nullable() - ->references('id') - ->on('report_fields') - ->cascadeOnDelete(); - } - ); + Schema::table('report_fields', function (Blueprint $table) { + $table + ->foreignId('parent_report_field_id') + ->nullable() + ->references('id') + ->on('report_fields') + ->cascadeOnDelete(); + }); } /** @@ -28,10 +26,8 @@ public function up(): void */ public function down(): void { - Schema::table( - 'report_fields', function (Blueprint $table) { - $table->dropColumn('parent_report_field_id'); - } - ); + Schema::table('report_fields', function (Blueprint $table) { + $table->dropColumn('parent_report_field_id'); + }); } }; diff --git a/database/migrations/2023_05_07_212854_create_notifications_table.php b/database/migrations/2023_05_07_212854_create_notifications_table.php index 873f7e4..a1d07b2 100644 --- a/database/migrations/2023_05_07_212854_create_notifications_table.php +++ b/database/migrations/2023_05_07_212854_create_notifications_table.php @@ -12,24 +12,22 @@ */ public function up(): void { - Schema::create( - 'notifications', function (Blueprint $table) { - $table->id(); - $table->json('content'); - $table - ->unsignedTinyInteger('type') - ->default(Notification::TYPE_INFO); - $table - ->unsignedTinyInteger('status') - ->default(Notification::STATUS_UNREAD); - $table - ->foreignId('user_id') - ->nullable() - ->constrained('users') - ->cascadeOnDelete(); - $table->timestamps(); - } - ); + Schema::create('notifications', function (Blueprint $table) { + $table->id(); + $table->json('content'); + $table + ->unsignedTinyInteger('type') + ->default(Notification::TYPE_INFO); + $table + ->unsignedTinyInteger('status') + ->default(Notification::STATUS_UNREAD); + $table + ->foreignId('user_id') + ->nullable() + ->constrained('users') + ->cascadeOnDelete(); + $table->timestamps(); + }); } /** diff --git a/database/migrations/2023_05_21_130609_add_user_id_to_transactions.php b/database/migrations/2023_05_21_130609_add_user_id_to_transactions.php index 8410b3d..1e3919f 100644 --- a/database/migrations/2023_05_21_130609_add_user_id_to_transactions.php +++ b/database/migrations/2023_05_21_130609_add_user_id_to_transactions.php @@ -8,22 +8,18 @@ { public function up(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + }); } public function down(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + }); } }; diff --git a/database/migrations/2023_05_21_131546_add_user_id_to_synchronizations.php b/database/migrations/2023_05_21_131546_add_user_id_to_synchronizations.php index ee70a8a..a62060e 100644 --- a/database/migrations/2023_05_21_131546_add_user_id_to_synchronizations.php +++ b/database/migrations/2023_05_21_131546_add_user_id_to_synchronizations.php @@ -8,22 +8,18 @@ { public function up(): void { - Schema::table( - 'synchronizations', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - } - ); + Schema::table('synchronizations', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + }); } public function down(): void { - Schema::table( - 'synchronizations', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - } - ); + Schema::table('synchronizations', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + }); } }; diff --git a/database/migrations/2023_05_21_131952_add_user_id_to_nordigen_requisitions.php b/database/migrations/2023_05_21_131952_add_user_id_to_nordigen_requisitions.php index de13586..20b3c97 100644 --- a/database/migrations/2023_05_21_131952_add_user_id_to_nordigen_requisitions.php +++ b/database/migrations/2023_05_21_131952_add_user_id_to_nordigen_requisitions.php @@ -8,22 +8,18 @@ { public function up(): void { - Schema::table( - 'nordigen_requisitions', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - } - ); + Schema::table('nordigen_requisitions', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + }); } public function down(): void { - Schema::table( - 'nordigen_requisitions', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - } - ); + Schema::table('nordigen_requisitions', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + }); } }; diff --git a/database/migrations/2023_05_21_132635_add_user_id_to_accounts.php b/database/migrations/2023_05_21_132635_add_user_id_to_accounts.php index 046a030..b7e54cd 100644 --- a/database/migrations/2023_05_21_132635_add_user_id_to_accounts.php +++ b/database/migrations/2023_05_21_132635_add_user_id_to_accounts.php @@ -8,22 +8,18 @@ { public function up(): void { - Schema::table( - 'accounts', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - } - ); + Schema::table('accounts', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + }); } public function down(): void { - Schema::table( - 'accounts', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - } - ); + Schema::table('accounts', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + }); } }; diff --git a/database/migrations/2023_05_21_133012_add_user_id_to_files.php b/database/migrations/2023_05_21_133012_add_user_id_to_files.php index 1c3e513..05f075e 100644 --- a/database/migrations/2023_05_21_133012_add_user_id_to_files.php +++ b/database/migrations/2023_05_21_133012_add_user_id_to_files.php @@ -8,22 +8,18 @@ { public function up(): void { - Schema::table( - 'files', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - } - ); + Schema::table('files', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + }); } public function down(): void { - Schema::table( - 'files', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - } - ); + Schema::table('files', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + }); } }; diff --git a/database/migrations/2023_05_21_133551_add_user_id_to_columns_mappings.php b/database/migrations/2023_05_21_133551_add_user_id_to_columns_mappings.php index 9b859aa..53e0e6f 100644 --- a/database/migrations/2023_05_21_133551_add_user_id_to_columns_mappings.php +++ b/database/migrations/2023_05_21_133551_add_user_id_to_columns_mappings.php @@ -8,22 +8,18 @@ { public function up(): void { - Schema::table( - 'columns_mappings', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - } - ); + Schema::table('columns_mappings', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + }); } public function down(): void { - Schema::table( - 'columns_mappings', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - } - ); + Schema::table('columns_mappings', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + }); } }; diff --git a/database/migrations/2023_05_21_133809_add_user_id_to_imports.php b/database/migrations/2023_05_21_133809_add_user_id_to_imports.php index 706329a..e4fac58 100644 --- a/database/migrations/2023_05_21_133809_add_user_id_to_imports.php +++ b/database/migrations/2023_05_21_133809_add_user_id_to_imports.php @@ -8,22 +8,18 @@ { public function up(): void { - Schema::table( - 'imports', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - } - ); + Schema::table('imports', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + }); } public function down(): void { - Schema::table( - 'imports', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - } - ); + Schema::table('imports', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + }); } }; diff --git a/database/migrations/2023_05_21_134604_add_user_id_to_nordigen_end_user_agreements.php b/database/migrations/2023_05_21_134604_add_user_id_to_nordigen_end_user_agreements.php index 434c320..1aa11c2 100644 --- a/database/migrations/2023_05_21_134604_add_user_id_to_nordigen_end_user_agreements.php +++ b/database/migrations/2023_05_21_134604_add_user_id_to_nordigen_end_user_agreements.php @@ -8,22 +8,18 @@ { public function up(): void { - Schema::table( - 'nordigen_end_user_agreements', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - } - ); + Schema::table('nordigen_end_user_agreements', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + }); } public function down(): void { - Schema::table( - 'nordigen_end_user_agreements', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - } - ); + Schema::table('nordigen_end_user_agreements', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + }); } }; diff --git a/database/migrations/2023_05_21_144237_add_user_id_to_import_settings.php b/database/migrations/2023_05_21_144237_add_user_id_to_import_settings.php index 8051626..d78d561 100644 --- a/database/migrations/2023_05_21_144237_add_user_id_to_import_settings.php +++ b/database/migrations/2023_05_21_144237_add_user_id_to_import_settings.php @@ -11,14 +11,12 @@ */ public function up(): void { - Schema::table( - 'import_settings', function (Blueprint $table) { - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - } - ); + Schema::table('import_settings', function (Blueprint $table) { + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + }); } /** @@ -26,10 +24,8 @@ public function up(): void */ public function down(): void { - Schema::table( - 'import_settings', function (Blueprint $table) { - $table->dropConstrainedForeignId('user_id'); - } - ); + Schema::table('import_settings', function (Blueprint $table) { + $table->dropConstrainedForeignId('user_id'); + }); } }; diff --git a/database/migrations/2023_05_23_110548_add_is_admin_to_users.php b/database/migrations/2023_05_23_110548_add_is_admin_to_users.php index 22fbc3a..6cbfbc3 100644 --- a/database/migrations/2023_05_23_110548_add_is_admin_to_users.php +++ b/database/migrations/2023_05_23_110548_add_is_admin_to_users.php @@ -8,19 +8,15 @@ { public function up(): void { - Schema::table( - 'users', function (Blueprint $table) { - $table->boolean('is_admin')->default(false); - } - ); + Schema::table('users', function (Blueprint $table) { + $table->boolean('is_admin')->default(false); + }); } public function down(): void { - Schema::table( - 'users', function (Blueprint $table) { - $table->dropColumn('is_admin'); - } - ); + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('is_admin'); + }); } }; diff --git a/database/migrations/2023_05_25_213554_create_jobs_table.php b/database/migrations/2023_05_25_213554_create_jobs_table.php index a63a61b..6098d9b 100644 --- a/database/migrations/2023_05_25_213554_create_jobs_table.php +++ b/database/migrations/2023_05_25_213554_create_jobs_table.php @@ -11,17 +11,15 @@ */ public function up(): void { - Schema::create( - 'jobs', function (Blueprint $table) { - $table->bigIncrements('id'); - $table->string('queue')->index(); - $table->longText('payload'); - $table->unsignedTinyInteger('attempts'); - $table->unsignedInteger('reserved_at')->nullable(); - $table->unsignedInteger('available_at'); - $table->unsignedInteger('created_at'); - } - ); + Schema::create('jobs', function (Blueprint $table) { + $table->bigIncrements('id'); + $table->string('queue')->index(); + $table->longText('payload'); + $table->unsignedTinyInteger('attempts'); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + }); } /** diff --git a/database/migrations/2023_05_26_171457_create_settings_table.php b/database/migrations/2023_05_26_171457_create_settings_table.php index 6e92823..f9f0c2d 100644 --- a/database/migrations/2023_05_26_171457_create_settings_table.php +++ b/database/migrations/2023_05_26_171457_create_settings_table.php @@ -8,19 +8,17 @@ { public function up(): void { - Schema::create( - 'settings', function (Blueprint $table) { - $table->id(); - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - $table - ->string('base_currency_code') - ->default(config('moneypenny.base_calculation_currency')); - $table->timestamps(); - } - ); + Schema::create('settings', function (Blueprint $table) { + $table->id(); + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + $table + ->string('base_currency_code') + ->default(config('moneypenny.base_calculation_currency')); + $table->timestamps(); + }); } public function down(): void diff --git a/database/migrations/2023_05_26_193636_create_categories_table.php b/database/migrations/2023_05_26_193636_create_categories_table.php index 1e54ec4..ae80341 100644 --- a/database/migrations/2023_05_26_193636_create_categories_table.php +++ b/database/migrations/2023_05_26_193636_create_categories_table.php @@ -8,13 +8,11 @@ { public function up(): void { - Schema::create( - 'categories', function (Blueprint $table) { - $table->id(); - $table->string('code'); - $table->timestamps(); - } - ); + Schema::create('categories', function (Blueprint $table) { + $table->id(); + $table->string('code'); + $table->timestamps(); + }); } public function down(): void diff --git a/database/migrations/2023_05_26_193833_add_category_id_to_transactions.php b/database/migrations/2023_05_26_193833_add_category_id_to_transactions.php index 4257d7a..ee56072 100644 --- a/database/migrations/2023_05_26_193833_add_category_id_to_transactions.php +++ b/database/migrations/2023_05_26_193833_add_category_id_to_transactions.php @@ -8,23 +8,19 @@ { public function up(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table - ->foreignId('category_id') - ->nullable() - ->constrained('categories') - ->nullOnDelete(); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table + ->foreignId('category_id') + ->nullable() + ->constrained('categories') + ->nullOnDelete(); + }); } public function down(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table->dropColumn('category_id'); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table->dropColumn('category_id'); + }); } }; diff --git a/database/migrations/2023_05_27_122301_create_job_batches_table.php b/database/migrations/2023_05_27_122301_create_job_batches_table.php index 8fe8ced..50e38c2 100644 --- a/database/migrations/2023_05_27_122301_create_job_batches_table.php +++ b/database/migrations/2023_05_27_122301_create_job_batches_table.php @@ -11,20 +11,18 @@ */ public function up(): void { - Schema::create( - 'job_batches', function (Blueprint $table) { - $table->string('id')->primary(); - $table->string('name'); - $table->integer('total_jobs'); - $table->integer('pending_jobs'); - $table->integer('failed_jobs'); - $table->longText('failed_job_ids'); - $table->mediumText('options')->nullable(); - $table->integer('cancelled_at')->nullable(); - $table->integer('created_at'); - $table->integer('finished_at')->nullable(); - } - ); + Schema::create('job_batches', function (Blueprint $table) { + $table->string('id')->primary(); + $table->string('name'); + $table->integer('total_jobs'); + $table->integer('pending_jobs'); + $table->integer('failed_jobs'); + $table->longText('failed_job_ids'); + $table->mediumText('options')->nullable(); + $table->integer('cancelled_at')->nullable(); + $table->integer('created_at'); + $table->integer('finished_at')->nullable(); + }); } /** diff --git a/database/migrations/2023_05_28_170228_create_budgets_table.php b/database/migrations/2023_05_28_170228_create_budgets_table.php index e6d0bf6..122203f 100644 --- a/database/migrations/2023_05_28_170228_create_budgets_table.php +++ b/database/migrations/2023_05_28_170228_create_budgets_table.php @@ -9,23 +9,21 @@ { public function up(): void { - Schema::create( - 'budgets', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table - ->unsignedSmallInteger('type') - ->default(Budget::TYPE_MONTH); - $table - ->decimal('amount') - ->nullable(); - $table - ->foreignId('user_id') - ->constrained('users') - ->cascadeOnDelete(); - $table->timestamps(); - } - ); + Schema::create('budgets', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table + ->unsignedSmallInteger('type') + ->default(Budget::TYPE_MONTH); + $table + ->decimal('amount') + ->nullable(); + $table + ->foreignId('user_id') + ->constrained('users') + ->cascadeOnDelete(); + $table->timestamps(); + }); } public function down(): void diff --git a/database/migrations/2023_06_01_102325_add_is_blocked_to_users.php b/database/migrations/2023_06_01_102325_add_is_blocked_to_users.php index 024e630..05057ea 100644 --- a/database/migrations/2023_06_01_102325_add_is_blocked_to_users.php +++ b/database/migrations/2023_06_01_102325_add_is_blocked_to_users.php @@ -8,19 +8,15 @@ { public function up(): void { - Schema::table( - 'users', function (Blueprint $table) { - $table->boolean('is_blocked')->default(false); - } - ); + Schema::table('users', function (Blueprint $table) { + $table->boolean('is_blocked')->default(false); + }); } public function down(): void { - Schema::table( - 'users', function (Blueprint $table) { - $table->dropColumn('is_blocked'); - } - ); + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('is_blocked'); + }); } }; diff --git a/database/migrations/2023_06_05_104930_add_code_to_synchronizations.php b/database/migrations/2023_06_05_104930_add_code_to_synchronizations.php index f8975a1..6e057f0 100644 --- a/database/migrations/2023_06_05_104930_add_code_to_synchronizations.php +++ b/database/migrations/2023_06_05_104930_add_code_to_synchronizations.php @@ -8,19 +8,15 @@ { public function up(): void { - Schema::table( - 'synchronizations', function (Blueprint $table) { - $table->smallInteger('code'); - } - ); + Schema::table('synchronizations', function (Blueprint $table) { + $table->smallInteger('code'); + }); } public function down(): void { - Schema::table( - 'synchronizations', function (Blueprint $table) { - $table->dropColumn('code'); - } - ); + Schema::table('synchronizations', function (Blueprint $table) { + $table->dropColumn('code'); + }); } }; diff --git a/database/migrations/2023_06_05_105419_make_code_column_nullable_at_synchronizations.php b/database/migrations/2023_06_05_105419_make_code_column_nullable_at_synchronizations.php index 128eca8..1f51eb6 100644 --- a/database/migrations/2023_06_05_105419_make_code_column_nullable_at_synchronizations.php +++ b/database/migrations/2023_06_05_105419_make_code_column_nullable_at_synchronizations.php @@ -8,25 +8,21 @@ { public function up(): void { - Schema::table( - 'synchronizations', function (Blueprint $table) { - $table - ->smallInteger('code') - ->nullable() - ->change(); - } - ); + Schema::table('synchronizations', function (Blueprint $table) { + $table + ->smallInteger('code') + ->nullable() + ->change(); + }); } public function down(): void { - Schema::table( - 'synchronizations', function (Blueprint $table) { - $table - ->smallInteger('code') - ->nullable(false) - ->change(); - } - ); + Schema::table('synchronizations', function (Blueprint $table) { + $table + ->smallInteger('code') + ->nullable(false) + ->change(); + }); } }; diff --git a/database/migrations/2023_06_16_015635_add_color_hex_to_categories.php b/database/migrations/2023_06_16_015635_add_color_hex_to_categories.php index 83f60b3..afdd76e 100644 --- a/database/migrations/2023_06_16_015635_add_color_hex_to_categories.php +++ b/database/migrations/2023_06_16_015635_add_color_hex_to_categories.php @@ -11,11 +11,9 @@ */ public function up(): void { - Schema::table( - 'categories', function (Blueprint $table) { - $table->string('color_hex', 7)->nullable(); - } - ); + Schema::table('categories', function (Blueprint $table) { + $table->string('color_hex', 7)->nullable(); + }); } /** @@ -23,10 +21,8 @@ public function up(): void */ public function down(): void { - Schema::table( - 'categories', function (Blueprint $table) { - $table->dropColumn('color_hex'); - } - ); + Schema::table('categories', function (Blueprint $table) { + $table->dropColumn('color_hex'); + }); } }; diff --git a/database/migrations/2023_06_22_132234_change_amount_column_length_at_budgets.php b/database/migrations/2023_06_22_132234_change_amount_column_length_at_budgets.php index 83843c5..5702416 100644 --- a/database/migrations/2023_06_22_132234_change_amount_column_length_at_budgets.php +++ b/database/migrations/2023_06_22_132234_change_amount_column_length_at_budgets.php @@ -8,25 +8,21 @@ { public function up(): void { - Schema::table( - 'budgets', function (Blueprint $table) { - $table - ->decimal('amount', 12) - ->nullable() - ->change(); - } - ); + Schema::table('budgets', function (Blueprint $table) { + $table + ->decimal('amount', 12) + ->nullable() + ->change(); + }); } public function down(): void { - Schema::table( - 'budgets', function (Blueprint $table) { - $table - ->decimal('amount') - ->nullable() - ->change(); - } - ); + Schema::table('budgets', function (Blueprint $table) { + $table + ->decimal('amount') + ->nullable() + ->change(); + }); } }; diff --git a/database/migrations/2023_12_26_171157_add_is_excluded_from_calculation_column_to_transactions_table.php b/database/migrations/2023_12_26_171157_add_is_excluded_from_calculation_column_to_transactions_table.php index 8c08a16..4508e54 100644 --- a/database/migrations/2023_12_26_171157_add_is_excluded_from_calculation_column_to_transactions_table.php +++ b/database/migrations/2023_12_26_171157_add_is_excluded_from_calculation_column_to_transactions_table.php @@ -8,21 +8,17 @@ { public function up(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table - ->boolean('is_excluded_from_calculation') - ->default(false); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table + ->boolean('is_excluded_from_calculation') + ->default(false); + }); } public function down(): void { - Schema::table( - 'transactions', function (Blueprint $table) { - $table->dropColumn('is_excluded_from_calculation'); - } - ); + Schema::table('transactions', function (Blueprint $table) { + $table->dropColumn('is_excluded_from_calculation'); + }); } }; diff --git a/database/seeders/ColumnsMappingsTableSeeder.php b/database/seeders/ColumnsMappingsTableSeeder.php index 6f34fdc..da4adda 100644 --- a/database/seeders/ColumnsMappingsTableSeeder.php +++ b/database/seeders/ColumnsMappingsTableSeeder.php @@ -13,8 +13,7 @@ class ColumnsMappingsTableSeeder extends Seeder */ public function run(): void { - ColumnsMapping::create( - [ + ColumnsMapping::create([ 'user_id' => User::first()->id, 'name' => 'Alior Export', 'transaction_date_column_index' => 0, @@ -26,7 +25,6 @@ public function run(): void 'currency_column_index' => 6, 'sender_account_number_column_index' => 9, 'receiver_account_number_column_index' => 10, - ] - ); + ]); } } diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 90b5891..ec54a3b 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -22,15 +22,13 @@ public function run(): void return; } - $this->call( - [ + $this->call([ UsersTableSeeder::class, ImportSettingsTableSeeder::class, ColumnsMappingsTableSeeder::class, CategoriesTableSeeder::class, TransactionsTableSeeder::class, FilesTableSeeder::class, - ] - ); + ]); } } diff --git a/database/seeders/FilesTableSeeder.php b/database/seeders/FilesTableSeeder.php index acc8ab1..75dc2db 100644 --- a/database/seeders/FilesTableSeeder.php +++ b/database/seeders/FilesTableSeeder.php @@ -17,15 +17,13 @@ class FilesTableSeeder extends Seeder public function run(): void { for ($i = 1; $i <= 10; $i++) { - File::create( - [ + File::create([ 'user_id' => User::inRandomOrder()->first()->id, 'name' => "file{$i}.csv", 'path' => "files/file{$i}.csv", 'import_setting_id' => ImportSetting::inRandomOrder()->first()->id, 'size' => rand(1024, 2048), - ] - ); + ]); } } } diff --git a/database/seeders/UsersTableSeeder.php b/database/seeders/UsersTableSeeder.php index 8c66211..8f624c1 100644 --- a/database/seeders/UsersTableSeeder.php +++ b/database/seeders/UsersTableSeeder.php @@ -14,23 +14,19 @@ class UsersTableSeeder extends Seeder public function run(): void { try { - User::factory()->create( - [ + User::factory()->create([ 'name' => 'Test User', 'email' => 'test@example.com', - ] - ); + ]); } catch (Throwable) { $this->command->warn(' ⚠️ Test user already exists.'); } try { - User::factory()->create( - [ + User::factory()->create([ 'name' => 'Guest User', 'email' => 'guest@example.com', - ] - ); + ]); } catch (Throwable) { $this->command->warn(' ⚠️ Guest user already exists.'); } @@ -38,12 +34,10 @@ public function run(): void try { User::factory() ->admin() - ->create( - [ + ->create([ 'name' => 'Admin User', 'email' => 'admin@example.com', - ] - ); + ]); } catch (Throwable) { $this->command->warn(' ⚠️ Admin user already exists.'); } diff --git a/resources/js/getCookie.js b/resources/js/getCookie.js index fd20407..0726014 100644 --- a/resources/js/getCookie.js +++ b/resources/js/getCookie.js @@ -3,10 +3,8 @@ export const getCookie = (cname) => { let ca = document.cookie.split(';'); for (let i = 0; i < ca.length; i++) { let c = ca[i]; - while (c.charAt(0) === ' ') { c = c.substring(1); - } - if (c.indexOf(name) !== -1) { return c.substring(name.length, c.length); - } + while (c.charAt(0) === ' ') c = c.substring(1); + if (c.indexOf(name) !== -1) return c.substring(name.length, c.length); } return ""; } diff --git a/tailwind.config.js b/tailwind.config.js index c2ce13a..14f4a42 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,8 +1,6 @@ const defaultTheme = require('tailwindcss/defaultTheme'); -/** - * @type {import('tailwindcss').Config} - */ +/** @type {import('tailwindcss').Config} */ module.exports = { darkMode: 'dark', From 55d071e83b623dfedf0c09fd2ffe55212d7e3604 Mon Sep 17 00:00:00 2001 From: mike Date: Thu, 28 Dec 2023 02:24:00 +0100 Subject: [PATCH 3/4] Add php version to versions matrix at github action --- .github/workflows/php_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php_test.yml b/.github/workflows/php_test.yml index 1b740b5..8ca9683 100644 --- a/.github/workflows/php_test.yml +++ b/.github/workflows/php_test.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - php: ['8.2'] + php: ['8.2', '8.3'] steps: - uses: actions/checkout@v1 From 940c339d9590ec9abac636693758b05ba014478f Mon Sep 17 00:00:00 2001 From: mike Date: Thu, 28 Dec 2023 02:25:52 +0100 Subject: [PATCH 4/4] Add rm php version from versions matrix at github action --- .github/workflows/php_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php_test.yml b/.github/workflows/php_test.yml index 8ca9683..1b740b5 100644 --- a/.github/workflows/php_test.yml +++ b/.github/workflows/php_test.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - php: ['8.2', '8.3'] + php: ['8.2'] steps: - uses: actions/checkout@v1