mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-04 11:48:05 +00:00
Clean up code.
This commit is contained in:
@@ -255,7 +255,7 @@ class ListController extends Controller
|
||||
$unfiltered = $recurringRepos->getAll();
|
||||
|
||||
// filter selection
|
||||
$collection = $unfiltered->filter(/** @phpstan-ignore-line */
|
||||
$collection = $unfiltered->filter( // @phpstan-ignore-line
|
||||
static function (Recurrence $recurrence) use ($currency) { // @phpstan-ignore-line
|
||||
/** @var RecurrenceTransaction $transaction */
|
||||
foreach ($recurrence->recurrenceTransactions as $transaction) {
|
||||
@@ -305,7 +305,7 @@ class ListController extends Controller
|
||||
$ruleRepos = app(RuleRepositoryInterface::class);
|
||||
$unfiltered = $ruleRepos->getAll();
|
||||
|
||||
$collection = $unfiltered->filter(/** @phpstan-ignore-line */
|
||||
$collection = $unfiltered->filter( // @phpstan-ignore-line
|
||||
static function (Rule $rule) use ($currency) { // @phpstan-ignore-line
|
||||
/** @var RuleTrigger $trigger */
|
||||
foreach ($rule->ruleTriggers as $trigger) {
|
||||
|
@@ -61,8 +61,7 @@ class DeleteEmptyJournals extends Command
|
||||
{
|
||||
$set = Transaction::whereNull('deleted_at')
|
||||
->groupBy('transactions.transaction_journal_id')
|
||||
->get([DB::raw('COUNT(transactions.transaction_journal_id) as the_count'), 'transaction_journal_id']);
|
||||
/** @phpstan-ignore-line */
|
||||
->get([DB::raw('COUNT(transactions.transaction_journal_id) as the_count'), 'transaction_journal_id']); // @phpstan-ignore-line
|
||||
$total = 0;
|
||||
/** @var Transaction $row */
|
||||
foreach ($set as $row) {
|
||||
|
@@ -33,8 +33,7 @@ class DestroyedTransactionLink extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
private TransactionJournalLink $link;
|
||||
/** @phpstan-ignore-line */
|
||||
private TransactionJournalLink $link; // @phpstan-ignore-line
|
||||
|
||||
/**
|
||||
* DestroyedTransactionLink constructor.
|
||||
|
@@ -50,7 +50,7 @@ class APIEventHandler
|
||||
if (null !== $user) {
|
||||
try {
|
||||
Notification::send($user, new NewAccessToken());
|
||||
} catch (Exception $e) { /** @phpstan-ignore-line */
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
$message = $e->getMessage();
|
||||
if (str_contains($message, 'Bcc')) {
|
||||
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
|
||||
|
@@ -31,7 +31,6 @@ use FireflyIII\Notifications\Admin\TestNotification;
|
||||
use FireflyIII\Notifications\Admin\UserInvitation;
|
||||
use FireflyIII\Notifications\Admin\VersionCheckResult;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
|
||||
/**
|
||||
@@ -58,7 +57,7 @@ class AdminEventHandler
|
||||
if ($repository->hasRole($user, 'owner')) {
|
||||
try {
|
||||
Notification::send($user, new UserInvitation($event->invitee));
|
||||
} catch (Exception $e) { /** @phpstan-ignore-line */
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
$message = $e->getMessage();
|
||||
if (str_contains($message, 'Bcc')) {
|
||||
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
|
||||
@@ -96,7 +95,7 @@ class AdminEventHandler
|
||||
if ($repository->hasRole($user, 'owner')) {
|
||||
try {
|
||||
Notification::send($user, new VersionCheckResult($event->message));
|
||||
} catch (Exception $e) { /** @phpstan-ignore-line */
|
||||
} catch (Exception $e) {// @phpstan-ignore-line
|
||||
$message = $e->getMessage();
|
||||
if (str_contains($message, 'Bcc')) {
|
||||
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
|
||||
@@ -130,7 +129,7 @@ class AdminEventHandler
|
||||
}
|
||||
try {
|
||||
Notification::send($event->user, new TestNotification($event->user->email));
|
||||
} catch (Exception $e) { /** @phpstan-ignore-line */
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
$message = $e->getMessage();
|
||||
if (str_contains($message, 'Bcc')) {
|
||||
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
|
||||
|
@@ -75,7 +75,7 @@ class AutomationHandler
|
||||
}
|
||||
try {
|
||||
Notification::send($user, new TransactionCreation($groups));
|
||||
} catch (Exception $e) { /** @phpstan-ignore-line */
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
$message = $e->getMessage();
|
||||
if (str_contains($message, 'Bcc')) {
|
||||
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
|
||||
|
@@ -51,7 +51,7 @@ class BillEventHandler
|
||||
app('log')->debug('Bill reminder is true!');
|
||||
try {
|
||||
Notification::send($bill->user, new BillReminder($bill, $event->field, $event->diff));
|
||||
} catch (Exception $e) { /** @phpstan-ignore-line */
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
$message = $e->getMessage();
|
||||
if (str_contains($message, 'Bcc')) {
|
||||
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
|
||||
|
@@ -93,7 +93,7 @@ class BudgetLimitHandler
|
||||
$viewRange = '1M';
|
||||
}
|
||||
// safety catch
|
||||
if(null === $viewRange || is_array($viewRange)){
|
||||
if (null === $viewRange || is_array($viewRange)) {
|
||||
$viewRange = '1M';
|
||||
}
|
||||
$viewRange = (string)$viewRange;
|
||||
|
@@ -131,7 +131,7 @@ class UserEventHandler
|
||||
$group = null;
|
||||
|
||||
// create a new group.
|
||||
while (true === $groupExists) { /** @phpstan-ignore-line */
|
||||
while (true === $groupExists) { // @phpstan-ignore-line
|
||||
$groupExists = UserGroup::where('title', $groupTitle)->count() > 0;
|
||||
if (false === $groupExists) {
|
||||
$group = UserGroup::create(['title' => $groupTitle]);
|
||||
@@ -205,7 +205,7 @@ class UserEventHandler
|
||||
if (false === $entry['notified']) {
|
||||
try {
|
||||
Notification::send($user, new UserLogin($ipAddress));
|
||||
} catch (Exception $e) {/** @phpstan-ignore-line */
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
$message = $e->getMessage();
|
||||
if (str_contains($message, 'Bcc')) {
|
||||
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
|
||||
@@ -239,7 +239,7 @@ class UserEventHandler
|
||||
if ($repository->hasRole($user, 'owner')) {
|
||||
try {
|
||||
Notification::send($user, new AdminRegistrationNotification($event->user));
|
||||
} catch (Exception $e) { /** @phpstan-ignore-line */
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
$message = $e->getMessage();
|
||||
if (str_contains($message, 'Bcc')) {
|
||||
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
|
||||
@@ -316,7 +316,7 @@ class UserEventHandler
|
||||
{
|
||||
try {
|
||||
Notification::send($event->user, new UserNewPassword(route('password.reset', [$event->token])));
|
||||
} catch (Exception $e) { /** @phpstan-ignore-line */
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
$message = $e->getMessage();
|
||||
if (str_contains($message, 'Bcc')) {
|
||||
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
|
||||
@@ -364,7 +364,7 @@ class UserEventHandler
|
||||
if ($sendMail) {
|
||||
try {
|
||||
Notification::send($event->user, new UserRegistrationNotification());
|
||||
} catch (Exception $e) { /** @phpstan-ignore-line */
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
$message = $e->getMessage();
|
||||
if (str_contains($message, 'Bcc')) {
|
||||
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
|
||||
|
@@ -103,7 +103,7 @@ class NetWorth implements NetWorthInterface
|
||||
foreach ($accounts as $account) {
|
||||
app('log')->debug(sprintf('Now at account #%d ("%s")', $account->id, $account->name));
|
||||
$currency = $this->getRepository()->getAccountCurrency($account);
|
||||
if(null === $currency) {
|
||||
if (null === $currency) {
|
||||
$currency = app('amount')->getDefaultCurrency();
|
||||
}
|
||||
$currencyId = $currency->id;
|
||||
|
@@ -152,7 +152,7 @@ class CreateController extends Controller
|
||||
|
||||
// update preferences if necessary:
|
||||
$frontPage = app('preferences')->get('frontPageAccounts', [])->data;
|
||||
if(!is_array($frontPage)) {
|
||||
if (!is_array($frontPage)) {
|
||||
$frontPage = [];
|
||||
}
|
||||
if (AccountType::ASSET === $account->accountType->type) {
|
||||
|
@@ -94,7 +94,7 @@ class EditController extends Controller
|
||||
$hasLocation = null !== $location;
|
||||
$locations = [
|
||||
'location' => [
|
||||
'latitude' => null !== old('location_latitude') ? old('location_latitude'): $latitude,
|
||||
'latitude' => null !== old('location_latitude') ? old('location_latitude') : $latitude,
|
||||
'longitude' => null !== old('location_longitude') ? old('location_longitude') : $longitude,
|
||||
'zoom_level' => null !== old('location_zoom_level') ? old('location_zoom_level') : $zoomLevel,
|
||||
'has_location' => $hasLocation || 'true' === old('location_has_location'),
|
||||
|
@@ -26,7 +26,6 @@ namespace FireflyIII\Http\Controllers\Admin;
|
||||
use FireflyIII\Events\AdminRequestedTestMessage;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Http\Middleware\IsDemoUser;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
use FireflyIII\Support\Notifications\UrlValidator;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
|
@@ -170,7 +170,7 @@ class UserController extends Controller
|
||||
$subTitle = (string)trans('firefly.user_administration');
|
||||
$subTitleIcon = 'fa-users';
|
||||
$users = $this->repository->all();
|
||||
$singleUserMode = (bool) app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$singleUserMode = (bool)app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$allowInvites = false;
|
||||
if (!$this->externalIdentity && $singleUserMode) {
|
||||
// also registration enabled.
|
||||
|
@@ -127,7 +127,7 @@ class AttachmentController extends Controller
|
||||
->header('Expires', '0')
|
||||
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
||||
->header('Pragma', 'public')
|
||||
->header('Content-Length', (string) strlen($content));
|
||||
->header('Content-Length', (string)strlen($content));
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
@@ -170,7 +170,7 @@ class TwoFactorController extends Controller
|
||||
private function isBackupCode(string $mfaCode): bool
|
||||
{
|
||||
$list = app('preferences')->get('mfa_recovery', [])->data;
|
||||
if(!is_array($list)) {
|
||||
if (!is_array($list)) {
|
||||
$list = [];
|
||||
}
|
||||
if (in_array($mfaCode, $list, true)) {
|
||||
@@ -188,7 +188,7 @@ class TwoFactorController extends Controller
|
||||
private function removeFromBackupCodes(string $mfaCode): void
|
||||
{
|
||||
$list = app('preferences')->get('mfa_recovery', [])->data;
|
||||
if(!is_array($list)) {
|
||||
if (!is_array($list)) {
|
||||
$list = [];
|
||||
}
|
||||
$newList = array_values(array_diff($list, [$mfaCode]));
|
||||
|
@@ -135,7 +135,7 @@ class IndexController extends Controller
|
||||
|
||||
// get budgeted for default currency:
|
||||
if (0 === count($availableBudgets)) {
|
||||
$budgeted = $this->blRepository->budgeted($start, $end, $defaultCurrency, );
|
||||
$budgeted = $this->blRepository->budgeted($start, $end, $defaultCurrency,);
|
||||
$spentArr = $this->opsRepository->sumExpenses($start, $end, null, null, $defaultCurrency);
|
||||
$spent = $spentArr[$defaultCurrency->id]['sum'] ?? '0';
|
||||
unset($spentArr);
|
||||
@@ -194,7 +194,7 @@ class IndexController extends Controller
|
||||
$array['spent'] = $spentArr[$entry->transaction_currency_id]['sum'] ?? '0';
|
||||
|
||||
// budgeted in period:
|
||||
$budgeted = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency, );
|
||||
$budgeted = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency,);
|
||||
$array['budgeted'] = $budgeted;
|
||||
$availableBudgets[] = $array;
|
||||
unset($spentArr);
|
||||
@@ -283,8 +283,7 @@ class IndexController extends Controller
|
||||
foreach ($budget['spent'] as $spent) {
|
||||
$currencyId = $spent['currency_id'];
|
||||
$sums['spent'][$currencyId]
|
||||
??=
|
||||
[
|
||||
??= [
|
||||
'amount' => '0',
|
||||
'currency_id' => $spent['currency_id'],
|
||||
'currency_symbol' => $spent['currency_symbol'],
|
||||
@@ -297,8 +296,7 @@ class IndexController extends Controller
|
||||
foreach ($budget['budgeted'] as $budgeted) {
|
||||
$currencyId = $budgeted['currency_id'];
|
||||
$sums['budgeted'][$currencyId]
|
||||
??=
|
||||
[
|
||||
??= [
|
||||
'amount' => '0',
|
||||
'currency_id' => $budgeted['currency_id'],
|
||||
'currency_symbol' => $budgeted['currency_symbol'],
|
||||
@@ -307,8 +305,8 @@ class IndexController extends Controller
|
||||
$sums['budgeted'][$currencyId]['amount'] = bcadd($sums['budgeted'][$currencyId]['amount'], $budgeted['amount']);
|
||||
|
||||
// also calculate how much left from budgeted:
|
||||
$sums['left'][$currencyId] ??=
|
||||
[
|
||||
$sums['left'][$currencyId]
|
||||
??= [
|
||||
'amount' => '0',
|
||||
'currency_id' => $budgeted['currency_id'],
|
||||
'currency_symbol' => $budgeted['currency_symbol'],
|
||||
|
@@ -147,7 +147,7 @@ class ExpenseReportController extends Controller
|
||||
|
||||
while ($currentStart < $end) {
|
||||
$currentEnd = clone $currentStart;
|
||||
$currentEnd = $currentEnd->$function(); /** @phpstan-ignore-line */
|
||||
$currentEnd = $currentEnd->$function(); // @phpstan-ignore-line
|
||||
|
||||
// get expenses grouped by opposing name:
|
||||
$expenses = $this->groupByName($this->getExpensesForOpposing($accounts, $all, $currentStart, $currentEnd));
|
||||
|
@@ -57,7 +57,7 @@ abstract class Controller extends BaseController
|
||||
{
|
||||
// is site a demo site?
|
||||
$isDemoSiteConfig = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site', false));
|
||||
$isDemoSite = (bool) $isDemoSiteConfig->data;
|
||||
$isDemoSite = (bool)$isDemoSiteConfig->data;
|
||||
app('view')->share('IS_DEMO_SITE', $isDemoSite);
|
||||
app('view')->share('DEMO_USERNAME', config('firefly.demo_username'));
|
||||
app('view')->share('DEMO_PASSWORD', config('firefly.demo_password'));
|
||||
|
@@ -42,6 +42,7 @@ use Illuminate\View\View;
|
||||
use Monolog\Handler\RotatingFileHandler;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use const PHP_SAPI;
|
||||
|
||||
/**
|
||||
* Class DebugController
|
||||
@@ -127,7 +128,7 @@ class DebugController extends Controller
|
||||
// get latest log file:
|
||||
$logger = Log::driver();
|
||||
// PHPstan doesn't recognize the method because of its polymorphic nature.
|
||||
$handlers = $logger->getHandlers(); /** @phpstan-ignore-line */
|
||||
$handlers = $logger->getHandlers(); // @phpstan-ignore-line
|
||||
$logContent = '';
|
||||
foreach ($handlers as $handler) {
|
||||
if ($handler instanceof RotatingFileHandler) {
|
||||
@@ -172,7 +173,7 @@ class DebugController extends Controller
|
||||
'db_version' => app('fireflyconfig')->get('db_version', 1)->data,
|
||||
'php_version' => PHP_VERSION,
|
||||
'php_os' => PHP_OS,
|
||||
'interface' => \PHP_SAPI,
|
||||
'interface' => PHP_SAPI,
|
||||
'bcscale' => bcscale(),
|
||||
'display_errors' => ini_get('display_errors'),
|
||||
'error_reporting' => $this->errorReporting((int)ini_get('error_reporting')),
|
||||
@@ -277,7 +278,7 @@ class DebugController extends Controller
|
||||
$result = setlocale(LC_ALL, $code);
|
||||
$localeAttempts[$code] = $result === $code;
|
||||
}
|
||||
setlocale(LC_ALL, (string) $original);
|
||||
setlocale(LC_ALL, (string)$original);
|
||||
|
||||
return [
|
||||
'user_id' => auth()->user()->id,
|
||||
|
@@ -102,7 +102,7 @@ class IndexController extends Controller
|
||||
->header('Expires', '0')
|
||||
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
||||
->header('Pragma', 'public')
|
||||
->header('Content-Length', (string) strlen($result['transactions']));
|
||||
->header('Content-Length', (string)strlen($result['transactions']));
|
||||
|
||||
// return CSV file made from 'transactions' array.
|
||||
return $response;
|
||||
|
@@ -80,7 +80,7 @@ class RecurrenceController extends Controller
|
||||
$repetitions = (int)$request->get('reps');
|
||||
$repetitionMoment = '';
|
||||
|
||||
if(false === $start || false === $end || false === $firstDate || false === $endDate) {
|
||||
if (false === $start || false === $end || false === $firstDate || false === $endDate) {
|
||||
return response()->json();
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ class RecurrenceController extends Controller
|
||||
} catch (InvalidFormatException $e) {
|
||||
$date = Carbon::today(config('app.timezone'));
|
||||
}
|
||||
if(false === $date) {
|
||||
if (false === $date) {
|
||||
return response()->json();
|
||||
}
|
||||
$date->startOfDay();
|
||||
|
@@ -107,9 +107,7 @@ class CategoryController extends Controller
|
||||
];
|
||||
|
||||
$report[$sourceAccountId]['currencies'][$currencyId]['categories'][$category['id']]
|
||||
??=
|
||||
|
||||
[
|
||||
??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
@@ -134,8 +132,7 @@ class CategoryController extends Controller
|
||||
foreach ($category['transaction_journals'] as $journal) {
|
||||
$destinationId = $journal['destination_account_id'];
|
||||
$report[$destinationId]['currencies'][$currencyId]
|
||||
??=
|
||||
[
|
||||
??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -143,9 +140,7 @@ class CategoryController extends Controller
|
||||
'categories' => [],
|
||||
];
|
||||
$report[$destinationId]['currencies'][$currencyId]['categories'][$category['id']]
|
||||
??=
|
||||
|
||||
[
|
||||
??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
|
@@ -100,9 +100,7 @@ class TagController extends Controller
|
||||
];
|
||||
|
||||
$report[$sourceAccountId]['currencies'][$currencyId]['tags'][$tag['id']]
|
||||
??=
|
||||
|
||||
[
|
||||
??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
@@ -127,8 +125,7 @@ class TagController extends Controller
|
||||
foreach ($tag['transaction_journals'] as $journal) {
|
||||
$destinationId = $journal['destination_account_id'];
|
||||
$report[$destinationId]['currencies'][$currencyId]
|
||||
??=
|
||||
[
|
||||
??= [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_name' => $currency['currency_name'],
|
||||
@@ -136,9 +133,7 @@ class TagController extends Controller
|
||||
'tags' => [],
|
||||
];
|
||||
$report[$destinationId]['currencies'][$currencyId]['tags'][$tag['id']]
|
||||
??=
|
||||
|
||||
[
|
||||
??= [
|
||||
'spent' => '0',
|
||||
'earned' => '0',
|
||||
'sum' => '0',
|
||||
|
@@ -49,6 +49,7 @@ use Psr\Container\NotFoundExceptionInterface;
|
||||
class ReportController extends Controller
|
||||
{
|
||||
use RenderPartialViews;
|
||||
|
||||
protected ReportHelperInterface $helper;
|
||||
private BudgetRepositoryInterface $repository;
|
||||
|
||||
@@ -328,7 +329,7 @@ class ReportController extends Controller
|
||||
* @throws FireflyException
|
||||
*
|
||||
*/
|
||||
public function postIndex(ReportFormRequest $request): RedirectResponse|Redirector|View
|
||||
public function postIndex(ReportFormRequest $request): RedirectResponse | Redirector | View
|
||||
{
|
||||
// report type:
|
||||
$reportType = $request->get('report_type');
|
||||
|
@@ -109,7 +109,7 @@ class SelectController extends Controller
|
||||
*
|
||||
* @return Factory|View|RedirectResponse
|
||||
*/
|
||||
public function selectTransactions(Rule $rule): Factory|View|RedirectResponse
|
||||
public function selectTransactions(Rule $rule): Factory | View | RedirectResponse
|
||||
{
|
||||
if (false === $rule->active) {
|
||||
session()->flash('warning', trans('firefly.cannot_fire_inactive_rules'));
|
||||
|
@@ -179,7 +179,7 @@ class InstallController extends Controller
|
||||
return;
|
||||
}
|
||||
|
||||
file_put_contents($publicKey, (string) $key->getPublicKey());
|
||||
file_put_contents($publicKey, (string)$key->getPublicKey());
|
||||
file_put_contents($privateKey, $key->toString('PKCS1'));
|
||||
}
|
||||
}
|
||||
|
@@ -101,7 +101,7 @@ class DeleteController extends Controller
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
*/
|
||||
public function destroy(TransactionGroup $group): RedirectResponse|Redirector
|
||||
public function destroy(TransactionGroup $group): RedirectResponse | Redirector
|
||||
{
|
||||
app('log')->debug(sprintf('Now in %s(#%d).', __METHOD__, $group->id));
|
||||
if (!$this->isEditableGroup($group)) {
|
||||
|
@@ -32,7 +32,6 @@ use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface
|
||||
use FireflyIII\Transformers\TransactionGroupTransformer;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
|
||||
@@ -81,7 +80,7 @@ class ShowController extends Controller
|
||||
* @return Factory|View
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function show( TransactionGroup $transactionGroup)
|
||||
public function show(TransactionGroup $transactionGroup)
|
||||
{
|
||||
/** @var TransactionJournal|null $first */
|
||||
$first = $transactionGroup->transactionJournals()->first(['transaction_journals.*']);
|
||||
|
@@ -26,7 +26,6 @@ namespace FireflyIII\Http\Controllers\Webhooks;
|
||||
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
/**
|
||||
|
@@ -69,13 +69,13 @@ class Range
|
||||
// ignore preference. set the range to be the current month:
|
||||
if (!app('session')->has('start') && !app('session')->has('end')) {
|
||||
$viewRange = app('preferences')->get('viewRange', '1M')->data;
|
||||
if(is_array($viewRange)) {
|
||||
if (is_array($viewRange)) {
|
||||
$viewRange = '1M';
|
||||
}
|
||||
|
||||
$today = today(config('app.timezone'));
|
||||
$start = app('navigation')->updateStartDate((string) $viewRange, $today);
|
||||
$end = app('navigation')->updateEndDate((string) $viewRange, $start);
|
||||
$start = app('navigation')->updateStartDate((string)$viewRange, $today);
|
||||
$end = app('navigation')->updateEndDate((string)$viewRange, $start);
|
||||
|
||||
app('session')->put('start', $start);
|
||||
app('session')->put('end', $end);
|
||||
|
@@ -121,7 +121,7 @@ class DownloadExchangeRates implements ShouldQueue
|
||||
return;
|
||||
}
|
||||
$date = Carbon::createFromFormat('Y-m-d', $json['date'], config('app.timezone'));
|
||||
if(false === $date) {
|
||||
if (false === $date) {
|
||||
return;
|
||||
}
|
||||
$this->saveRates($currency, $date, $json['rates']);
|
||||
|
@@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Jobs;
|
||||
|
||||
use Exception;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Message;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
@@ -90,7 +89,7 @@ class MailError extends Job implements ShouldQueue
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (Exception | TransportException $e) { /** @phpstan-ignore-line */
|
||||
} catch (Exception | TransportException $e) { // @phpstan-ignore-line
|
||||
$message = $e->getMessage();
|
||||
if (str_contains($message, 'Bcc')) {
|
||||
app('log')->warning('[Bcc] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.');
|
||||
|
@@ -40,9 +40,7 @@ class AccessTokenCreatedMail extends Mailable
|
||||
/**
|
||||
* AccessTokenCreatedMail constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
public function __construct() {}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
|
@@ -44,9 +44,7 @@ class AdminTestMail extends Mailable
|
||||
/**
|
||||
* AdminTestMail constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
public function __construct() {}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
|
@@ -53,7 +53,7 @@ class InvitationMail extends Mailable
|
||||
$this->invitee = $invitee;
|
||||
$this->admin = $admin;
|
||||
$this->url = $url;
|
||||
$this->host = (string) parse_url($url, PHP_URL_HOST);
|
||||
$this->host = (string)parse_url($url, PHP_URL_HOST);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -292,22 +292,9 @@ class Account extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the virtual balance
|
||||
*
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function virtualBalance(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Get the user ID
|
||||
*
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function accountTypeId(): Attribute
|
||||
protected function accountId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
@@ -315,9 +302,11 @@ class Account extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user ID
|
||||
*
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function accountId(): Attribute
|
||||
protected function accountTypeId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
@@ -334,4 +323,16 @@ class Account extends Model
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the virtual balance
|
||||
*
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function virtualBalance(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
@@ -31,7 +32,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\AutoBudget
|
||||
@@ -96,7 +96,7 @@ class AutoBudget extends Model
|
||||
protected function amount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (string)$value,
|
||||
get: static fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
|
||||
@@ -32,7 +33,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Carbon\Carbon;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
@@ -131,9 +131,10 @@ class AvailableBudget extends Model
|
||||
protected function amount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (string)$value,
|
||||
get: static fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
|
@@ -242,19 +242,7 @@ class Bill extends Model
|
||||
protected function amountMax(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the skip
|
||||
*
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function skip(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (int)$value,
|
||||
get: static fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -266,17 +254,7 @@ class Bill extends Model
|
||||
protected function amountMin(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function transactionCurrencyId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (int)$value,
|
||||
get: static fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -286,7 +264,29 @@ class Bill extends Model
|
||||
protected function order(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (int)$value,
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the skip
|
||||
*
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function skip(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function transactionCurrencyId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -181,6 +181,7 @@ class Budget extends Model
|
||||
{
|
||||
return $this->belongsToMany(Transaction::class, 'budget_transaction', 'budget_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
|
@@ -134,7 +134,7 @@ class BudgetLimit extends Model
|
||||
protected function amount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (string)$value,
|
||||
get: static fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
@@ -35,7 +36,7 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\Category
|
||||
*
|
||||
|
@@ -25,10 +25,11 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\Configuration
|
||||
*
|
||||
|
@@ -22,8 +22,10 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@@ -31,7 +33,6 @@ use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Class CurrencyExchangeRate
|
||||
@@ -111,26 +112,6 @@ class CurrencyExchangeRate extends Model
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function rate(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function userRate(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
@@ -141,6 +122,16 @@ class CurrencyExchangeRate extends Model
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function rate(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
@@ -151,5 +142,15 @@ class CurrencyExchangeRate extends Model
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function userRate(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -26,13 +26,14 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* Class GroupMembership
|
||||
*
|
||||
|
@@ -26,13 +26,14 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* Class InvitedUser
|
||||
*
|
||||
|
@@ -25,13 +25,14 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\LinkType
|
||||
*
|
||||
|
@@ -26,13 +26,14 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\Location
|
||||
*
|
||||
|
@@ -25,12 +25,13 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\Note
|
||||
*
|
||||
|
@@ -26,6 +26,7 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@@ -35,7 +36,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\ObjectGroup
|
||||
*
|
||||
|
@@ -23,7 +23,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -33,9 +35,8 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Carbon\Carbon;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\PiggyBank
|
||||
*
|
||||
@@ -182,18 +183,6 @@ class PiggyBank extends Model
|
||||
$this->attributes['targetamount'] = (string)$value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the max amount
|
||||
*
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function targetamount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
@@ -214,4 +203,16 @@ class PiggyBank extends Model
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the max amount
|
||||
*
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function targetamount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -23,13 +23,14 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\PiggyBankEvent
|
||||
*
|
||||
@@ -102,7 +103,7 @@ class PiggyBankEvent extends Model
|
||||
protected function amount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (string)$value,
|
||||
get: static fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -25,11 +25,12 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\PiggyBankRepetition
|
||||
*
|
||||
@@ -130,7 +131,7 @@ class PiggyBankRepetition extends Model
|
||||
protected function currentamount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (string)$value,
|
||||
get: static fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -25,13 +25,14 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\Preference
|
||||
*
|
||||
@@ -94,7 +95,7 @@ class Preference extends Model
|
||||
$preference = new self();
|
||||
$preference->name = $value;
|
||||
$preference->data = $default[$value];
|
||||
$preference->user_id = (int) $user->id;
|
||||
$preference->user_id = (int)$user->id;
|
||||
$preference->save();
|
||||
|
||||
return $preference;
|
||||
|
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
@@ -36,7 +37,7 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\Recurrence
|
||||
*
|
||||
|
@@ -25,12 +25,13 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\RecurrenceMeta
|
||||
*
|
||||
|
@@ -23,7 +23,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -31,8 +33,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\RecurrenceTransaction
|
||||
*
|
||||
@@ -170,25 +171,14 @@ class RecurrenceTransaction extends Model
|
||||
protected function amount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (string)$value,
|
||||
get: static fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function foreignAmount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (string)$value,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function recurrenceId(): Attribute
|
||||
protected function destinationId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
@@ -198,7 +188,18 @@ class RecurrenceTransaction extends Model
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function transactionCurrencyId(): Attribute
|
||||
protected function foreignAmount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (string)$value,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function recurrenceId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
@@ -218,7 +219,7 @@ class RecurrenceTransaction extends Model
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function destinationId(): Attribute
|
||||
protected function transactionCurrencyId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
|
@@ -25,12 +25,13 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\RecurrenceTransactionMeta
|
||||
*
|
||||
|
@@ -23,9 +23,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
@@ -35,7 +36,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\Rule
|
||||
*
|
||||
@@ -178,7 +179,7 @@ class Rule extends Model
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function ruleGroupId(): Attribute
|
||||
protected function order(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
@@ -188,7 +189,7 @@ class Rule extends Model
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function order(): Attribute
|
||||
protected function ruleGroupId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
|
@@ -25,11 +25,12 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\RuleAction
|
||||
*
|
||||
@@ -84,7 +85,7 @@ class RuleAction extends Model
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function ruleId(): Attribute
|
||||
protected function order(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
@@ -94,7 +95,7 @@ class RuleAction extends Model
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function order(): Attribute
|
||||
protected function ruleId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
|
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
@@ -35,7 +36,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\RuleGroup
|
||||
*
|
||||
|
@@ -25,11 +25,12 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\RuleTrigger
|
||||
*
|
||||
@@ -84,7 +85,7 @@ class RuleTrigger extends Model
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function ruleId(): Attribute
|
||||
protected function order(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
@@ -94,7 +95,7 @@ class RuleTrigger extends Model
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function order(): Attribute
|
||||
protected function ruleId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
|
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
@@ -35,7 +36,7 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\Tag
|
||||
*
|
||||
|
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
@@ -33,7 +34,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\Transaction
|
||||
*
|
||||
@@ -253,6 +254,16 @@ class Transaction extends Model
|
||||
return $this->belongsTo(TransactionJournal::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function accountId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount
|
||||
*
|
||||
@@ -261,7 +272,7 @@ class Transaction extends Model
|
||||
protected function amount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (string)$value,
|
||||
get: static fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -273,19 +284,10 @@ class Transaction extends Model
|
||||
protected function foreignAmount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (string)$value,
|
||||
get: static fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function accountId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
|
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
@@ -34,7 +35,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\TransactionGroup
|
||||
*
|
||||
|
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@@ -39,7 +40,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\TransactionJournal
|
||||
*
|
||||
@@ -395,15 +396,6 @@ class TransactionJournal extends Model
|
||||
return $this->hasMany(Transaction::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function transactionTypeId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
@@ -413,4 +405,14 @@ class TransactionJournal extends Model
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function transactionTypeId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
@@ -32,7 +33,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\TransactionJournalLink
|
||||
*
|
||||
@@ -131,6 +132,17 @@ class TransactionJournalLink extends Model
|
||||
{
|
||||
return $this->belongsTo(TransactionJournal::class, 'source_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function destinationId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
@@ -150,13 +162,4 @@ class TransactionJournalLink extends Model
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function destinationId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -25,12 +25,13 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\TransactionJournalMeta
|
||||
*
|
||||
@@ -95,7 +96,7 @@ class TransactionJournalMeta extends Model
|
||||
{
|
||||
$data = json_encode($value);
|
||||
$this->attributes['data'] = $data;
|
||||
$this->attributes['hash'] = hash('sha256', (string) $data);
|
||||
$this->attributes['hash'] = hash('sha256', (string)$data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,6 +106,7 @@ class TransactionJournalMeta extends Model
|
||||
{
|
||||
return $this->belongsTo(TransactionJournal::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
|
@@ -25,13 +25,14 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\TransactionType
|
||||
*
|
||||
|
@@ -27,6 +27,7 @@ namespace FireflyIII\Models;
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
@@ -35,7 +36,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* Class UserGroup
|
||||
*
|
||||
|
@@ -26,11 +26,12 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* Class UserRole
|
||||
*
|
||||
|
@@ -28,6 +28,7 @@ use Eloquent;
|
||||
use FireflyIII\Enums\WebhookDelivery;
|
||||
use FireflyIII\Enums\WebhookResponse;
|
||||
use FireflyIII\Enums\WebhookTrigger;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@@ -37,7 +38,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\Webhook
|
||||
*
|
||||
|
@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -32,7 +33,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* Class WebhookAttempt
|
||||
*
|
||||
|
@@ -23,7 +23,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
@@ -31,9 +33,8 @@ use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Carbon\Carbon;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\WebhookMessage
|
||||
*
|
||||
@@ -127,7 +128,7 @@ class WebhookMessage extends Model
|
||||
protected function sent(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (bool)$value,
|
||||
get: static fn($value) => (bool)$value,
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -43,9 +43,7 @@ class NewAccessToken extends Notification
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
public function __construct() {}
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
|
@@ -40,9 +40,7 @@ class UserRegistration extends Notification
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
public function __construct() {}
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
|
@@ -42,9 +42,7 @@ class AccountServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
public function boot(): void {}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
|
@@ -36,9 +36,7 @@ class AdminServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
public function boot(): void {}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
|
@@ -36,9 +36,7 @@ class AttachmentServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
public function boot(): void {}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
|
@@ -38,9 +38,7 @@ class BillServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
public function boot(): void {}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
|
@@ -50,9 +50,7 @@ class BudgetServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
public function boot(): void {}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
|
@@ -40,9 +40,7 @@ class CategoryServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
public function boot(): void {}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
|
@@ -38,9 +38,7 @@ class CurrencyServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
public function boot(): void {}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
|
@@ -46,9 +46,7 @@ class JournalServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
public function boot(): void {}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
|
@@ -38,9 +38,7 @@ class PiggyBankServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
public function boot(): void {}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
|
@@ -36,9 +36,7 @@ class RecurringServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
public function boot(): void {}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
|
@@ -36,9 +36,7 @@ class RuleGroupServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
public function boot(): void {}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
|
@@ -36,9 +36,7 @@ class RuleServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
public function boot(): void {}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
|
@@ -36,9 +36,7 @@ class SearchServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
public function boot(): void {}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
|
@@ -38,9 +38,7 @@ class TagServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
public function boot(): void {}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
|
@@ -116,7 +116,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
|
||||
->where('accounts.active', true)
|
||||
->where(
|
||||
static function (EloquentBuilder $q1) use ($number) { /** @phpstan-ignore-line */
|
||||
static function (EloquentBuilder $q1) use ($number) { // @phpstan-ignore-line
|
||||
$json = json_encode($number);
|
||||
$q1->where('account_meta.name', '=', 'account_number');
|
||||
$q1->where('account_meta.data', '=', $json);
|
||||
|
@@ -272,7 +272,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
'currency_code' => $journal['currency_code'],
|
||||
'currency_decimal_places' => $journal['currency_decimal_places'],
|
||||
];
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->$direction($journal['amount']));/** @phpstan-ignore-line */
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->$direction($journal['amount'])); // @phpstan-ignore-line
|
||||
|
||||
// also do foreign amount:
|
||||
$foreignId = (int)$journal['foreign_currency_id'];
|
||||
|
@@ -200,7 +200,7 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface
|
||||
{
|
||||
$query = TransactionJournal::leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->groupBy('transaction_journals.id');
|
||||
$result = $query->get(['transaction_journals.id as id', DB::raw('count(transactions.id) as transaction_count')]); /** @phpstan-ignore-line */
|
||||
$result = $query->get(['transaction_journals.id as id', DB::raw('count(transactions.id) as transaction_count')]); // @phpstan-ignore-line
|
||||
$journalIds = [];
|
||||
/** @var stdClass $row */
|
||||
foreach ($result as $row) {
|
||||
|
@@ -536,7 +536,7 @@ class RecurringRepository implements RecurringRepositoryInterface
|
||||
//
|
||||
$today = today(config('app.timezone'))->endOfYear();
|
||||
$repDate = Carbon::createFromFormat('Y-m-d', $repetition->repetition_moment);
|
||||
if(false === $repDate) {
|
||||
if (false === $repDate) {
|
||||
$repDate = clone $today;
|
||||
}
|
||||
$diffInYears = $today->diffInYears($repDate);
|
||||
|
@@ -374,6 +374,26 @@ class TagRepository implements TagRepositoryInterface
|
||||
return $sums;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function tagEndsWith(string $query): Collection
|
||||
{
|
||||
$search = sprintf('%%%s', $query);
|
||||
|
||||
return $this->user->tags()->where('tag', 'LIKE', $search)->get(['tags.*']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function tagStartsWith(string $query): Collection
|
||||
{
|
||||
$search = sprintf('%s%%', $query);
|
||||
|
||||
return $this->user->tags()->where('tag', 'LIKE', $search)->get(['tags.*']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Tag $tag
|
||||
* @param Carbon $start
|
||||
@@ -454,24 +474,4 @@ class TagRepository implements TagRepositoryInterface
|
||||
/** @var Location|null */
|
||||
return $tag->locations()->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function tagStartsWith(string $query): Collection
|
||||
{
|
||||
$search = sprintf('%s%%', $query);
|
||||
|
||||
return $this->user->tags()->where('tag', 'LIKE', $search)->get(['tags.*']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function tagEndsWith(string $query): Collection
|
||||
{
|
||||
$search = sprintf('%%%s', $query);
|
||||
|
||||
return $this->user->tags()->where('tag', 'LIKE', $search)->get(['tags.*']);
|
||||
}
|
||||
}
|
||||
|
@@ -153,24 +153,6 @@ interface TagRepositoryInterface
|
||||
*/
|
||||
public function searchTag(string $query): Collection;
|
||||
|
||||
/**
|
||||
* Find one or more tags that start with the string in the query
|
||||
*
|
||||
* @param string $query
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function tagStartsWith(string $query): Collection;
|
||||
|
||||
/**
|
||||
* Find one or more tags that start with the string in the query
|
||||
*
|
||||
* @param string $query
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function tagEndsWith(string $query): Collection;
|
||||
|
||||
/**
|
||||
* Search the users tags.
|
||||
*
|
||||
@@ -206,6 +188,24 @@ interface TagRepositoryInterface
|
||||
*/
|
||||
public function sumsOfTag(Tag $tag, ?Carbon $start, ?Carbon $end): array;
|
||||
|
||||
/**
|
||||
* Find one or more tags that start with the string in the query
|
||||
*
|
||||
* @param string $query
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function tagEndsWith(string $query): Collection;
|
||||
|
||||
/**
|
||||
* Find one or more tags that start with the string in the query
|
||||
*
|
||||
* @param string $query
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function tagStartsWith(string $query): Collection;
|
||||
|
||||
/**
|
||||
* @param Tag $tag
|
||||
* @param Carbon $start
|
||||
|
@@ -40,6 +40,50 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
{
|
||||
use UserGroupTrait;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function findByAccountNumber(string $number, array $types): ?Account
|
||||
{
|
||||
$dbQuery = $this->userGroup
|
||||
->accounts()
|
||||
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
|
||||
->where('accounts.active', true)
|
||||
->where(
|
||||
static function (EloquentBuilder $q1) use ($number) { // @phpstan-ignore-line
|
||||
$json = json_encode($number);
|
||||
$q1->where('account_meta.name', '=', 'account_number');
|
||||
$q1->where('account_meta.data', '=', $json);
|
||||
}
|
||||
);
|
||||
|
||||
if (0 !== count($types)) {
|
||||
$dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
|
||||
$dbQuery->whereIn('account_types.type', $types);
|
||||
}
|
||||
/** @var Account|null */
|
||||
return $dbQuery->first(['accounts.*']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $iban
|
||||
* @param array $types
|
||||
*
|
||||
* @return Account|null
|
||||
*/
|
||||
public function findByIbanNull(string $iban, array $types): ?Account
|
||||
{
|
||||
$query = $this->userGroup->accounts()->where('iban', '!=', '')->whereNotNull('iban');
|
||||
|
||||
if (0 !== count($types)) {
|
||||
$query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
|
||||
$query->whereIn('account_types.type', $types);
|
||||
}
|
||||
|
||||
/** @var Account|null */
|
||||
return $query->where('iban', $iban)->first(['accounts.*']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@@ -66,31 +110,6 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
return $account;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function findByAccountNumber(string $number, array $types): ?Account
|
||||
{
|
||||
$dbQuery = $this->userGroup
|
||||
->accounts()
|
||||
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
|
||||
->where('accounts.active', true)
|
||||
->where(
|
||||
static function (EloquentBuilder $q1) use ($number) { /** @phpstan-ignore-line */
|
||||
$json = json_encode($number);
|
||||
$q1->where('account_meta.name', '=', 'account_number');
|
||||
$q1->where('account_meta.data', '=', $json);
|
||||
}
|
||||
);
|
||||
|
||||
if (0 !== count($types)) {
|
||||
$dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
|
||||
$dbQuery->whereIn('account_types.type', $types);
|
||||
}
|
||||
/** @var Account|null */
|
||||
return $dbQuery->first(['accounts.*']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
*
|
||||
@@ -245,22 +264,4 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
|
||||
return $dbQuery->take($limit)->get(['accounts.*']);
|
||||
}
|
||||
/**
|
||||
* @param string $iban
|
||||
* @param array $types
|
||||
*
|
||||
* @return Account|null
|
||||
*/
|
||||
public function findByIbanNull(string $iban, array $types): ?Account
|
||||
{
|
||||
$query = $this->userGroup->accounts()->where('iban', '!=', '')->whereNotNull('iban');
|
||||
|
||||
if (0 !== count($types)) {
|
||||
$query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
|
||||
$query->whereIn('account_types.type', $types);
|
||||
}
|
||||
|
||||
/** @var Account|null */
|
||||
return $query->where('iban', $iban)->first(['accounts.*']);
|
||||
}
|
||||
}
|
||||
|
@@ -37,19 +37,11 @@ use Illuminate\Support\Collection;
|
||||
interface AccountRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* @param UserGroup $userGroup
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUserGroup(UserGroup $userGroup): void;
|
||||
|
||||
/**
|
||||
* @param string $iban
|
||||
* @param array $types
|
||||
* @param int $accountId
|
||||
*
|
||||
* @return Account|null
|
||||
*/
|
||||
public function findByIbanNull(string $iban, array $types): ?Account;
|
||||
public function find(int $accountId): ?Account;
|
||||
|
||||
/**
|
||||
* @param string $number
|
||||
@@ -60,18 +52,12 @@ interface AccountRepositoryInterface
|
||||
public function findByAccountNumber(string $number, array $types): ?Account;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUser(User $user): void;
|
||||
|
||||
/**
|
||||
* @param int $accountId
|
||||
* @param string $iban
|
||||
* @param array $types
|
||||
*
|
||||
* @return Account|null
|
||||
*/
|
||||
public function find(int $accountId): ?Account;
|
||||
public function findByIbanNull(string $iban, array $types): ?Account;
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
@@ -129,5 +115,19 @@ interface AccountRepositoryInterface
|
||||
*/
|
||||
public function searchAccount(string $query, array $types, int $limit): Collection;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUser(User $user): void;
|
||||
|
||||
/**
|
||||
* @param UserGroup $userGroup
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUserGroup(UserGroup $userGroup): void;
|
||||
|
||||
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user