Clean up code.

This commit is contained in:
James Cole 2023-12-10 06:51:59 +01:00
parent c2b22a2bac
commit 46e130fdfe
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
195 changed files with 973 additions and 984 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -33,8 +33,7 @@ class DestroyedTransactionLink extends Event
{
use SerializesModels;
private TransactionJournalLink $link;
/** @phpstan-ignore-line */
private TransactionJournalLink $link; // @phpstan-ignore-line
/**
* DestroyedTransactionLink constructor.

View File

@ -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.');

View File

@ -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.');

View File

@ -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.');

View File

@ -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.');

View File

@ -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;
@ -190,8 +190,8 @@ class BudgetLimitHandler
);
// overlap in days:
$limitPeriod = Period::make(
$budgetLimit->start_date,
$budgetLimit->end_date,
$budgetLimit->start_date,
$budgetLimit->end_date,
precision : Precision::DAY(),
boundaries: Boundaries::EXCLUDE_NONE()
);
@ -236,8 +236,8 @@ class BudgetLimitHandler
return '0';
}
$limitPeriod = Period::make(
$budgetLimit->start_date,
$budgetLimit->end_date,
$budgetLimit->start_date,
$budgetLimit->end_date,
precision : Precision::DAY(),
boundaries: Boundaries::EXCLUDE_NONE()
);

View File

@ -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.');

View File

@ -56,9 +56,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = str_contains(strtolower($attachment['filename']), strtolower($name)) || str_contains(
strtolower($attachment['title']),
strtolower($name)
);
strtolower($attachment['title']),
strtolower($name)
);
if (true === $result) {
return true;
}
@ -142,9 +142,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = !str_contains(strtolower($attachment['filename']), strtolower($name)) && !str_contains(
strtolower($attachment['title']),
strtolower($name)
);
strtolower($attachment['title']),
strtolower($name)
);
if (true === $result) {
return true;
}
@ -179,9 +179,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = !str_ends_with(strtolower($attachment['filename']), strtolower($name)) && !str_ends_with(
strtolower($attachment['title']),
strtolower($name)
);
strtolower($attachment['title']),
strtolower($name)
);
if (true === $result) {
return true;
}
@ -216,9 +216,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = !str_starts_with(strtolower($attachment['filename']), strtolower($name)) && !str_starts_with(
strtolower($attachment['title']),
strtolower($name)
);
strtolower($attachment['title']),
strtolower($name)
);
if (true === $result) {
return true;
}
@ -246,9 +246,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = str_ends_with(strtolower($attachment['filename']), strtolower($name)) || str_ends_with(
strtolower($attachment['title']),
strtolower($name)
);
strtolower($attachment['title']),
strtolower($name)
);
if (true === $result) {
return true;
}
@ -330,9 +330,9 @@ trait AttachmentCollection
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = str_starts_with(strtolower($attachment['filename']), strtolower($name)) || str_starts_with(
strtolower($attachment['title']),
strtolower($name)
);
strtolower($attachment['title']),
strtolower($name)
);
if (true === $result) {
return true;
}

View File

@ -102,8 +102,8 @@ class NetWorth implements NetWorthInterface
/** @var Account $account */
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) {
$currency = $this->getRepository()->getAccountCurrency($account);
if (null === $currency) {
$currency = app('amount')->getDefaultCurrency();
}
$currencyId = $currency->id;
@ -208,7 +208,7 @@ class NetWorth implements NetWorthInterface
$balance = bcsub($balance, $virtualBalance);
}
$return[$currency->id] ??= [
$return[$currency->id] ??= [
'id' => (string)$currency->id,
'name' => $currency->name,
'symbol' => $currency->symbol,

View File

@ -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) {

View File

@ -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'),

View File

@ -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;

View File

@ -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.

View File

@ -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;
}

View File

@ -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)) {
@ -187,8 +187,8 @@ class TwoFactorController extends Controller
*/
private function removeFromBackupCodes(string $mfaCode): void
{
$list = app('preferences')->get('mfa_recovery', [])->data;
if(!is_array($list)) {
$list = app('preferences')->get('mfa_recovery', [])->data;
if (!is_array($list)) {
$list = [];
}
$newList = array_values(array_diff($list, [$mfaCode]));

View File

@ -249,7 +249,7 @@ class IndexController extends Controller
* @var array $entry
*/
foreach ($array as $currencyId => $entry) {
$totals[$currencyId] ??= [
$totals[$currencyId] ??= [
'currency_id' => $currencyId,
'currency_code' => $entry['currency_code'],
'currency_name' => $entry['currency_name'],

View File

@ -135,8 +135,8 @@ class BudgetLimitController extends Controller
if (null === $currency || null === $budget) {
throw new FireflyException('No valid currency or budget.');
}
$start = Carbon::createFromFormat('Y-m-d', $request->get('start'));
$end = Carbon::createFromFormat('Y-m-d', $request->get('end'));
$start = Carbon::createFromFormat('Y-m-d', $request->get('start'));
$end = Carbon::createFromFormat('Y-m-d', $request->get('end'));
if (false === $start || false === $end) {
return response()->json([]);

View File

@ -106,13 +106,13 @@ class IndexController extends Controller
$isCustomRange = session('is_custom_range', false);
if (false === $isCustomRange) {
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
$end ??= app('navigation')->endOfPeriod($start, $range);
$end ??= app('navigation')->endOfPeriod($start, $range);
}
// overrule start and end if necessary:
if (true === $isCustomRange) {
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
$end ??= session('end', today(config('app.timezone'))->endOfMonth());
$end ??= session('end', today(config('app.timezone'))->endOfMonth());
}
@ -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,13 +283,12 @@ 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'],
'currency_decimal_places' => $spent['currency_decimal_places'],
];
??= [
'amount' => '0',
'currency_id' => $spent['currency_id'],
'currency_symbol' => $spent['currency_symbol'],
'currency_decimal_places' => $spent['currency_decimal_places'],
];
$sums['spent'][$currencyId]['amount'] = bcadd($sums['spent'][$currencyId]['amount'], $spent['spent']);
}
@ -297,23 +296,22 @@ 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'],
'currency_decimal_places' => $budgeted['currency_decimal_places'],
];
??= [
'amount' => '0',
'currency_id' => $budgeted['currency_id'],
'currency_symbol' => $budgeted['currency_symbol'],
'currency_decimal_places' => $budgeted['currency_decimal_places'],
];
$sums['budgeted'][$currencyId]['amount'] = bcadd($sums['budgeted'][$currencyId]['amount'], $budgeted['amount']);
// also calculate how much left from budgeted:
$sums['left'][$currencyId] ??=
[
'amount' => '0',
'currency_id' => $budgeted['currency_id'],
'currency_symbol' => $budgeted['currency_symbol'],
'currency_decimal_places' => $budgeted['currency_decimal_places'],
];
$sums['left'][$currencyId]
??= [
'amount' => '0',
'currency_id' => $budgeted['currency_id'],
'currency_symbol' => $budgeted['currency_symbol'],
'currency_decimal_places' => $budgeted['currency_decimal_places'],
];
}
}
// final calculation for 'left':

View File

@ -90,7 +90,7 @@ class ShowController extends Controller
/** @var Carbon $start */
$start ??= session('start');
/** @var Carbon $end */
$end ??= session('end');
$end ??= session('end');
$subTitle = trans(
'firefly.without_budget_between',
['start' => $start->isoFormat($this->monthAndDayFormat), 'end' => $end->isoFormat($this->monthAndDayFormat)]

View File

@ -86,7 +86,7 @@ class NoCategoryController extends Controller
/** @var Carbon $start */
$start ??= session('start');
/** @var Carbon $end */
$end ??= session('end');
$end ??= session('end');
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
$subTitle = trans(

View File

@ -88,7 +88,7 @@ class ShowController extends Controller
/** @var Carbon $start */
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
/** @var Carbon $end */
$end ??= session('end', today(config('app.timezone'))->endOfMonth());
$end ??= session('end', today(config('app.timezone'))->endOfMonth());
$subTitleIcon = 'fa-bookmark';
$page = (int)$request->get('page');
$attachments = $this->repository->getAttachments($category);

View File

@ -237,7 +237,7 @@ class BudgetController extends Controller
// group by asset account ID:
foreach ($journals as $journal) {
$key = sprintf('%d-%d', (int)$journal['source_account_id'], $journal['currency_id']);
$result[$key] ??= [
$result[$key] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@ -302,7 +302,7 @@ class BudgetController extends Controller
$chartData = [];
foreach ($journals as $journal) {
$key = sprintf('%d-%d', $journal['category_id'], $journal['currency_id']);
$result[$key] ??= [
$result[$key] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@ -367,7 +367,7 @@ class BudgetController extends Controller
/** @var array $journal */
foreach ($journals as $journal) {
$key = sprintf('%d-%d', $journal['destination_account_id'], $journal['currency_id']);
$result[$key] ??= [
$result[$key] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],

View File

@ -86,7 +86,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['budget_name'] ?? trans('firefly.no_budget');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@ -192,7 +192,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@ -228,7 +228,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@ -364,7 +364,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@ -400,7 +400,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],

View File

@ -85,7 +85,7 @@ class DoubleReportController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$categoryName = $journal['budget_name'] ?? trans('firefly.no_budget');
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@ -120,7 +120,7 @@ class DoubleReportController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$categoryName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@ -155,7 +155,7 @@ class DoubleReportController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$categoryName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@ -323,7 +323,7 @@ class DoubleReportController extends Controller
// do something
$tagName = trans('firefly.no_tags');
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@ -341,7 +341,7 @@ class DoubleReportController extends Controller
// do something
$tagName = $tag['name'];
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@ -383,7 +383,7 @@ class DoubleReportController extends Controller
// do something
$tagName = trans('firefly.no_tags');
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@ -401,7 +401,7 @@ class DoubleReportController extends Controller
// do something
$tagName = $tag['name'];
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],

View File

@ -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));
@ -166,7 +166,7 @@ class ExpenseReportController extends Controller
$currentExpense = $expenses[$name] ?? '0';
// add to sum:
$sumOfIncome[$exp->id] ??= '0';
$sumOfIncome[$exp->id] ??= '0';
$sumOfExpense[$exp->id] ??= '0';
$sumOfIncome[$exp->id] = bcadd($sumOfIncome[$exp->id], $currentIncome);
$sumOfExpense[$exp->id] = bcadd($sumOfExpense[$exp->id], $currentExpense);

View File

@ -182,7 +182,7 @@ class ReportController extends Controller
foreach ($journals as $journal) {
$period = $journal['date']->format($format);
$currencyId = (int)$journal['currency_id'];
$data[$currencyId] ??= [
$data[$currencyId] ??= [
'currency_id' => $currencyId,
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],

View File

@ -87,7 +87,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['budget_name'] ?? trans('firefly.no_budget');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@ -123,7 +123,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@ -159,7 +159,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@ -195,7 +195,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@ -231,7 +231,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@ -369,7 +369,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@ -405,7 +405,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
$result[$title] ??= [
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],

View File

@ -78,7 +78,7 @@ class TransactionController extends Controller
foreach ($result as $journal) {
$budget = $journal['budget_name'] ?? (string)trans('firefly.no_budget');
$title = sprintf('%s (%s)', $budget, $journal['currency_symbol']);
$data[$title] ??= [
$data[$title] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@ -131,7 +131,7 @@ class TransactionController extends Controller
foreach ($result as $journal) {
$category = $journal['category_name'] ?? (string)trans('firefly.no_category');
$title = sprintf('%s (%s)', $category, $journal['currency_symbol']);
$data[$title] ??= [
$data[$title] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@ -184,7 +184,7 @@ class TransactionController extends Controller
foreach ($result as $journal) {
$name = $journal['destination_account_name'];
$title = sprintf('%s (%s)', $name, $journal['currency_symbol']);
$data[$title] ??= [
$data[$title] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@ -237,7 +237,7 @@ class TransactionController extends Controller
foreach ($result as $journal) {
$name = $journal['source_account_name'];
$title = sprintf('%s (%s)', $name, $journal['currency_symbol']);
$data[$title] ??= [
$data[$title] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],

View File

@ -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'));

View File

@ -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,

View File

@ -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;

View File

@ -47,7 +47,7 @@ class JavascriptController extends Controller
/**
* Show info about accounts.
*
* @param AccountRepositoryInterface $repository
* @param AccountRepositoryInterface $repository
*
* @return Response
* @throws ContainerExceptionInterface
@ -101,8 +101,8 @@ class JavascriptController extends Controller
/**
* Show some common variables to be used in scripts.
*
* @param Request $request
* @param AccountRepositoryInterface $repository
* @param Request $request
* @param AccountRepositoryInterface $repository
*
* @return Response
* @throws FireflyException

View File

@ -86,12 +86,12 @@ class BoxController extends Controller
static function (AvailableBudget $availableBudget) use ($currency) { // @phpstan-ignore-line
if ($availableBudget->transaction_currency_id === $currency->id) {
app('log')->debug(sprintf(
'Will include AB #%d: from %s-%s amount %s',
$availableBudget->id,
$availableBudget->start_date->format('Y-m-d'),
$availableBudget->end_date->format('Y-m-d'),
$availableBudget->amount
));
'Will include AB #%d: from %s-%s amount %s',
$availableBudget->id,
$availableBudget->start_date->format('Y-m-d'),
$availableBudget->end_date->format('Y-m-d'),
$availableBudget->amount
));
return $availableBudget;
}
@ -181,7 +181,7 @@ class BoxController extends Controller
$amount = $journal['amount'] ?? '0';
$incomes[$currencyId] ??= '0';
$incomes[$currencyId] = bcadd($incomes[$currencyId], app('steam')->positive($amount));
$sums[$currencyId] ??= '0';
$sums[$currencyId] ??= '0';
$sums[$currencyId] = bcadd($sums[$currencyId], app('steam')->positive($amount));
}
@ -196,7 +196,7 @@ class BoxController extends Controller
$currencyId = (int)$journal['currency_id'];
$expenses[$currencyId] ??= '0';
$expenses[$currencyId] = bcadd($expenses[$currencyId], $journal['amount'] ?? '0');
$sums[$currencyId] ??= '0';
$sums[$currencyId] ??= '0';
$sums[$currencyId] = bcadd($sums[$currencyId], $journal['amount']);
}

View File

@ -46,7 +46,7 @@ class IntroController extends Controller
public function getIntroSteps(string $route, string $specificPage = null): JsonResponse
{
app('log')->debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
$specificPage ??= '';
$specificPage ??= '';
$steps = $this->getBasicSteps($route);
$specificSteps = $this->getSpecificSteps($route, $specificPage);
if (0 === count($specificSteps)) {

View File

@ -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();

View File

@ -98,8 +98,8 @@ class PreferencesController extends Controller
/** @var array<int, int> $accountIds */
$accountIds = $accounts->pluck('id')->toArray();
$viewRange = app('navigation')->getViewRange(false);
$frontPageAccountsPref = app('preferences')->get('frontPageAccounts', $accountIds);
$frontPageAccounts = $frontPageAccountsPref->data;
$frontPageAccountsPref = app('preferences')->get('frontPageAccounts', $accountIds);
$frontPageAccounts = $frontPageAccountsPref->data;
if (!is_array($frontPageAccounts)) {
$frontPageAccounts = $accountIds;
}

View File

@ -104,7 +104,7 @@ class BalanceController extends Controller
foreach ($journals as $journal) {
$sourceAccount = $journal['source_account_id'];
$currencyId = $journal['currency_id'];
$spent[$sourceAccount] ??= [
$spent[$sourceAccount] ??= [
'source_account_id' => $sourceAccount,
'currency_id' => $journal['currency_id'],
'currency_code' => $journal['currency_code'],
@ -116,7 +116,7 @@ class BalanceController extends Controller
$spent[$sourceAccount]['spent'] = bcadd($spent[$sourceAccount]['spent'], $journal['amount']);
// also fix sum:
$report['sums'][$budgetId][$currencyId] ??= [
$report['sums'][$budgetId][$currencyId] ??= [
'sum' => '0',
'currency_id' => $journal['currency_id'],
'currency_code' => $journal['currency_code'],

View File

@ -130,7 +130,7 @@ class BudgetController extends Controller
foreach ($currency['budgets'] as $budget) {
foreach ($budget['transaction_journals'] as $journal) {
$sourceAccountId = $journal['source_account_id'];
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@ -167,7 +167,7 @@ class BudgetController extends Controller
foreach ($budget['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id'];
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
$result[$key] ??= [
$result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
@ -240,7 +240,7 @@ class BudgetController extends Controller
foreach ($budget['transaction_journals'] as $journal) {
// add currency info to report array:
$report[$budgetId]['currencies'][$currencyId] ??= [
$report[$budgetId]['currencies'][$currencyId] ??= [
'sum' => '0',
'sum_pct' => '0',
'currency_id' => $currency['currency_id'],
@ -332,7 +332,7 @@ class BudgetController extends Controller
$count++;
$key = sprintf('%d-%d', $budget['id'], $currency['currency_id']);
$dateKey = $journal['date']->format($keyFormat);
$report[$key] ??= [
$report[$key] ??= [
'id' => $budget['id'],
'name' => sprintf('%s (%s)', $budget['name'], $currency['currency_name']),
'sum' => '0',

View File

@ -107,13 +107,11 @@ class CategoryController extends Controller
];
$report[$sourceAccountId]['currencies'][$currencyId]['categories'][$category['id']]
??=
[
'spent' => '0',
'earned' => '0',
'sum' => '0',
];
??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
];
$report[$sourceAccountId]['currencies'][$currencyId]['categories'][$category['id']]['spent'] = bcadd(
$report[$sourceAccountId]['currencies'][$currencyId]['categories'][$category['id']]['spent'],
$journal['amount']
@ -134,22 +132,19 @@ 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'],
'currency_decimal_places' => $currency['currency_decimal_places'],
'categories' => [],
];
??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
'currency_decimal_places' => $currency['currency_decimal_places'],
'categories' => [],
];
$report[$destinationId]['currencies'][$currencyId]['categories'][$category['id']]
??=
[
'spent' => '0',
'earned' => '0',
'sum' => '0',
];
??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
];
$report[$destinationId]['currencies'][$currencyId]['categories'][$category['id']]['earned'] = bcadd(
$report[$destinationId]['currencies'][$currencyId]['categories'][$category['id']]['earned'],
$journal['amount']
@ -205,7 +200,7 @@ class CategoryController extends Controller
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
$sourceAccountId = $journal['source_account_id'];
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@ -243,7 +238,7 @@ class CategoryController extends Controller
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
$destinationAccountId = $journal['destination_account_id'];
$report[$destinationAccountId]['currencies'][$currencyId] ??= [
$report[$destinationAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@ -287,7 +282,7 @@ class CategoryController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id'];
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
$result[$key] ??= [
$result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
@ -415,7 +410,7 @@ class CategoryController extends Controller
foreach ($category['transaction_journals'] as $journal) {
// add currency info to report array:
$report[$categoryId]['currencies'][$currencyId] ??= [
$report[$categoryId]['currencies'][$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@ -456,7 +451,7 @@ class CategoryController extends Controller
foreach ($category['transaction_journals'] as $journal) {
// add currency info to report array:
$report[$categoryId]['currencies'][$currencyId] ??= [
$report[$categoryId]['currencies'][$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',

View File

@ -141,7 +141,7 @@ class DoubleController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id'];
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
$result[$key] ??= [
$result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',

View File

@ -162,7 +162,7 @@ class OperationsController extends Controller
/** @var int $currencyId */
foreach ($keys as $currencyId) {
$currencyInfo = $incomes['sums'][$currencyId] ?? $expenses['sums'][$currencyId];
$sums[$currencyId] ??= [
$sums[$currencyId] ??= [
'currency_id' => $currencyId,
'currency_name' => $currencyInfo['currency_name'],
'currency_code' => $currencyInfo['currency_code'],

View File

@ -100,13 +100,11 @@ class TagController extends Controller
];
$report[$sourceAccountId]['currencies'][$currencyId]['tags'][$tag['id']]
??=
[
'spent' => '0',
'earned' => '0',
'sum' => '0',
];
??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
];
$report[$sourceAccountId]['currencies'][$currencyId]['tags'][$tag['id']]['spent'] = bcadd(
$report[$sourceAccountId]['currencies'][$currencyId]['tags'][$tag['id']]['spent'],
$journal['amount']
@ -127,22 +125,19 @@ 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'],
'currency_decimal_places' => $currency['currency_decimal_places'],
'tags' => [],
];
??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
'currency_decimal_places' => $currency['currency_decimal_places'],
'tags' => [],
];
$report[$destinationId]['currencies'][$currencyId]['tags'][$tag['id']]
??=
[
'spent' => '0',
'earned' => '0',
'sum' => '0',
];
??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
];
$report[$destinationId]['currencies'][$currencyId]['tags'][$tag['id']]['earned'] = bcadd(
$report[$destinationId]['currencies'][$currencyId]['tags'][$tag['id']]['earned'],
$journal['amount']
@ -198,7 +193,7 @@ class TagController extends Controller
foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) {
$sourceAccountId = $journal['source_account_id'];
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@ -236,7 +231,7 @@ class TagController extends Controller
foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) {
$destinationAccountId = $journal['destination_account_id'];
$report[$destinationAccountId]['currencies'][$currencyId] ??= [
$report[$destinationAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@ -280,7 +275,7 @@ class TagController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id'];
$key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
$result[$key] ??= [
$result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
@ -408,7 +403,7 @@ class TagController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
// add currency info to report array:
$report[$tagId]['currencies'][$currencyId] ??= [
$report[$tagId]['currencies'][$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@ -449,7 +444,7 @@ class TagController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
// add currency info to report array:
$report[$tagId]['currencies'][$currencyId] ??= [
$report[$tagId]['currencies'][$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',

View File

@ -49,7 +49,8 @@ use Psr\Container\NotFoundExceptionInterface;
class ReportController extends Controller
{
use RenderPartialViews;
protected ReportHelperInterface $helper;
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');

View File

@ -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'));
@ -136,7 +136,7 @@ class SelectController extends Controller
public function testTriggers(TestRuleFormRequest $request): JsonResponse
{
// build fake rule
$rule = new Rule();
$rule = new Rule();
/** @var \Illuminate\Database\Eloquent\Collection<int, RuleTrigger> $triggers */
$triggers = new Collection();
$rule->strict = '1' === $request->get('strict');

View File

@ -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'));
}
}

View File

@ -243,8 +243,8 @@ class TagController extends Controller
$subTitleIcon = 'fa-tag';
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
$start ??= session('start');
$end ??= session('end');
$start ??= session('start');
$end ??= session('end');
$location = $this->repository->getLocation($tag);
$attachments = $this->repository->getAttachments($tag);
$subTitle = trans(

View File

@ -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)) {

View File

@ -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.*']);
@ -162,9 +161,9 @@ class ShowController extends Controller
$amounts[$symbol]['amount'] = bcadd($amounts[$symbol]['amount'], $transaction['amount']);
if (null !== $transaction['foreign_amount'] && '' !== $transaction['foreign_amount']
&& bccomp(
'0',
$transaction['foreign_amount']
) !== 0) {
'0',
$transaction['foreign_amount']
) !== 0) {
// same for foreign currency:
$foreignSymbol = $transaction['foreign_currency_symbol'];
if (!array_key_exists($foreignSymbol, $amounts)) {

View File

@ -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;
/**

View File

@ -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);
$today = today(config('app.timezone'));
$start = app('navigation')->updateStartDate((string)$viewRange, $today);
$end = app('navigation')->updateEndDate((string)$viewRange, $start);
app('session')->put('start', $start);
app('session')->put('end', $end);

View File

@ -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']);

View File

@ -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.');

View File

@ -40,9 +40,7 @@ class AccessTokenCreatedMail extends Mailable
/**
* AccessTokenCreatedMail constructor.
*/
public function __construct()
{
}
public function __construct() {}
/**
* Build the message.

View File

@ -44,9 +44,7 @@ class AdminTestMail extends Mailable
/**
* AdminTestMail constructor.
*/
public function __construct()
{
}
public function __construct() {}
/**
* Build the message.

View File

@ -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);
}
/**

View File

@ -49,13 +49,13 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $account_type_id
* @property int $account_type_id
* @property string $name
* @property string $virtual_balance
* @property string|null $iban
* @property bool $active
* @property bool $encrypted
* @property int $order
* @property int $order
* @property-read Collection|AccountMeta[] $accountMeta
* @property-read int|null $account_meta_count
* @property AccountType $accountType
@ -103,7 +103,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Location $location
* @property string $liability_direction
* @property string $current_debt
* @property int $user_group_id
* @property int $user_group_id
* @method static EloquentBuilder|Account whereUserGroupId($value)
* @property-read UserGroup|null $userGroup
* @mixin Eloquent
@ -127,7 +127,7 @@ class Account extends Model
protected $fillable = ['user_id', 'user_group_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
protected $hidden = ['encrypted'];
protected $hidden = ['encrypted'];
private bool $joinedAccountTypes = false;
/**
@ -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,
);
}
}

View File

@ -36,7 +36,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $account_id
* @property int $account_id
* @property string $name
* @property mixed $data
* @property-read Account $account

View File

@ -45,8 +45,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $attachable_id
* @property int $user_id
* @property int $attachable_id
* @property string $attachable_type
* @property bool $file_exists
* @property string $md5
@ -81,7 +81,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static \Illuminate\Database\Eloquent\Builder|Attachment whereUserId($value)
* @method static Builder|Attachment withTrashed()
* @method static Builder|Attachment withoutTrashed()
* @property int $user_group_id
* @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Attachment whereUserGroupId($value)
* @mixin Eloquent
*/

View File

@ -48,9 +48,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $auditable_id
* @property int $auditable_id
* @property string $auditable_type
* @property int $changer_id
* @property int $changer_id
* @property string $changer_type
* @property string $action
* @property array|null $before

View File

@ -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
@ -40,8 +40,8 @@ use Carbon\Carbon;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $budget_id
* @property int $transaction_currency_id
* @property int $budget_id
* @property int $transaction_currency_id
* @property int|string $auto_budget_type
* @property string $amount
* @property string $period
@ -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,
);
}

View File

@ -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;
/**
@ -42,8 +42,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $transaction_currency_id
* @property int $user_id
* @property int $transaction_currency_id
* @property string $amount
* @property Carbon $start_date
* @property Carbon $end_date
@ -64,7 +64,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static \Illuminate\Database\Eloquent\Builder|AvailableBudget whereUserId($value)
* @method static Builder|AvailableBudget withTrashed()
* @method static Builder|AvailableBudget withoutTrashed()
* @property int $user_group_id
* @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|AvailableBudget whereUserGroupId($value)
* @mixin Eloquent
*/
@ -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
*/

View File

@ -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,
);
}

View File

@ -46,11 +46,11 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $user_id
* @property string $name
* @property bool $active
* @property bool $encrypted
* @property int $order
* @property int $order
* @property-read Collection|Attachment[] $attachments
* @property-read int|null $attachments_count
* @property-read Collection|AutoBudget[] $autoBudgets
@ -78,7 +78,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|Budget withTrashed()
* @method static Builder|Budget withoutTrashed()
* @property string $email
* @property int $user_group_id
* @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Budget whereUserGroupId($value)
* @property-read Collection|Note[] $notes
* @property-read int|null $notes_count
@ -181,6 +181,7 @@ class Budget extends Model
{
return $this->belongsToMany(Transaction::class, 'budget_transaction', 'budget_id');
}
/**
* @return Attribute
*/

View File

@ -41,8 +41,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $budget_id
* @property int $transaction_currency_id
* @property int $budget_id
* @property int $transaction_currency_id
* @property Carbon $start_date
* @property Carbon|null $end_date
* @property string $amount
@ -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,
);
}

View File

@ -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
*
@ -43,7 +44,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $user_id
* @property string $name
* @property Carbon $lastActivity
* @property bool $encrypted
@ -69,7 +70,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @method static \Illuminate\Database\Eloquent\Builder|Category whereUserId($value)
* @method static Builder|Category withTrashed()
* @method static Builder|Category withoutTrashed()
* @property int $user_group_id
* @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Category whereUserGroupId($value)
* @mixin Eloquent
*/

View File

@ -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
*

View File

@ -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
@ -40,9 +41,9 @@ use Carbon\Carbon;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $deleted_at
* @property int $user_id
* @property int $from_currency_id
* @property int $to_currency_id
* @property int $user_id
* @property int $from_currency_id
* @property int $to_currency_id
* @property Carbon $date
* @property string $rate
* @property string $user_rate
@ -62,7 +63,7 @@ use Carbon\Carbon;
* @method static Builder|CurrencyExchangeRate whereUpdatedAt($value)
* @method static Builder|CurrencyExchangeRate whereUserId($value)
* @method static Builder|CurrencyExchangeRate whereUserRate($value)
* @property int $user_group_id
* @property int $user_group_id
* @method static Builder|CurrencyExchangeRate whereUserGroupId($value)
* @method static Builder|CurrencyExchangeRate onlyTrashed()
* @method static Builder|CurrencyExchangeRate withTrashed()
@ -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,
);
}
}

View File

@ -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
*
@ -40,9 +41,9 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $deleted_at
* @property int $user_id
* @property int $user_group_id
* @property int $user_role_id
* @property int $user_id
* @property int $user_group_id
* @property int $user_role_id
* @property-read User $user
* @property-read UserGroup $userGroup
* @property-read UserRole $userRole

View File

@ -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
*
@ -43,7 +44,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $user_id
* @property int $user_id
* @property string $email
* @property string $invite_code
* @property Carbon $expires

View File

@ -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
*

View File

@ -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
*
@ -40,7 +41,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $locatable_id
* @property int $locatable_id
* @property string $locatable_type
* @property float|null $latitude
* @property float|null $longitude

View File

@ -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
*
@ -38,7 +39,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $noteable_id
* @property int $noteable_id
* @property string $noteable_type
* @property string|null $title
* @property string|null $text

View File

@ -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,17 +36,17 @@ 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
*
* @property int $id
* @property int $user_id
* @property int $user_id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property string $title
* @property int $order
* @property int $order
* @property-read Collection|Account[] $accounts
* @property-read int|null $accounts_count
* @property-read Collection|Bill[] $bills
@ -63,7 +64,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @method static Builder|ObjectGroup whereTitle($value)
* @method static Builder|ObjectGroup whereUpdatedAt($value)
* @method static Builder|ObjectGroup whereUserId($value)
* @property int $user_group_id
* @property int $user_group_id
* @method static Builder|ObjectGroup whereUserGroupId($value)
* @mixin Eloquent
*/

View File

@ -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
*
@ -43,12 +44,12 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $account_id
* @property int $account_id
* @property string $name
* @property string $targetamount
* @property Carbon|null $startdate
* @property Carbon|null $targetdate
* @property int $order
* @property int $order
* @property bool $active
* @property bool $encrypted
* @property-read Account $account
@ -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,
);
}
}

View File

@ -23,20 +23,21 @@ 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
*
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $piggy_bank_id
* @property int $piggy_bank_id
* @property int|null $transaction_journal_id
* @property Carbon $date
* @property string $amount
@ -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,
);
}

View File

@ -25,18 +25,19 @@ 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
*
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $piggy_bank_id
* @property int $piggy_bank_id
* @property Carbon|null $startdate
* @property Carbon|null $targetdate
* @property string $currentamount
@ -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,
);
}

View File

@ -25,20 +25,21 @@ 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
*
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $user_id
* @property int $user_id
* @property string $name
* @property int|string|array|null $data
* @property-read User $user
@ -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;

View File

@ -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
*
@ -44,8 +45,8 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $transaction_type_id
* @property int $user_id
* @property int $transaction_type_id
* @property string $title
* @property string $description
* @property Carbon|null $first_date
@ -87,7 +88,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @method static \Illuminate\Database\Eloquent\Builder|Recurrence whereUserId($value)
* @method static Builder|Recurrence withTrashed()
* @method static Builder|Recurrence withoutTrashed()
* @property int $user_group_id
* @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Recurrence whereUserGroupId($value)
* @mixin Eloquent
*/

View File

@ -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
*
@ -38,7 +39,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $recurrence_id
* @property int $recurrence_id
* @property string $name
* @property mixed $value
* @property-read Recurrence $recurrence

View File

@ -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
*
@ -40,11 +41,11 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $recurrence_id
* @property int $transaction_currency_id
* @property int $recurrence_id
* @property int $transaction_currency_id
* @property int|string|null $foreign_currency_id
* @property int $source_id
* @property int $destination_id
* @property int $source_id
* @property int $destination_id
* @property string $amount
* @property string $foreign_amount
* @property string $description
@ -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,

View File

@ -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
*

View File

@ -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;

View File

@ -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
*
@ -43,11 +44,11 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $rule_group_id
* @property int $user_id
* @property int $rule_group_id
* @property string $title
* @property string|null $description
* @property int $order
* @property int $order
* @property bool $active
* @property bool $stop_processing
* @property bool $strict
@ -76,7 +77,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @method static \Illuminate\Database\Eloquent\Builder|Rule whereUserId($value)
* @method static Builder|Rule withTrashed()
* @method static Builder|Rule withoutTrashed()
* @property int $user_group_id
* @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Rule whereUserGroupId($value)
* @property-read UserGroup|null $userGroup
* @mixin Eloquent
@ -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,

View File

@ -25,21 +25,22 @@ 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
*
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $rule_id
* @property int $rule_id
* @property string|null $action_type
* @property string|null $action_value
* @property int $order
* @property int $order
* @property bool $active
* @property bool $stop_processing
* @property-read Rule $rule
@ -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,

View File

@ -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
*
@ -43,10 +44,10 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $user_id
* @property string|null $title
* @property string|null $description
* @property int $order
* @property int $order
* @property bool $active
* @property bool $stop_processing
* @property Collection|Rule[] $rules
@ -68,7 +69,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @method static \Illuminate\Database\Eloquent\Builder|RuleGroup whereUserId($value)
* @method static Builder|RuleGroup withTrashed()
* @method static Builder|RuleGroup withoutTrashed()
* @property int $user_group_id
* @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|RuleGroup whereUserGroupId($value)
* @mixin Eloquent
*/

View File

@ -25,21 +25,22 @@ 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
*
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $rule_id
* @property int $rule_id
* @property string|null $trigger_type
* @property string|null $trigger_value
* @property int $order
* @property int $order
* @property bool $active
* @property bool $stop_processing
* @property-read Rule $rule
@ -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,

View File

@ -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
*
@ -43,7 +44,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $user_id
* @property string $tag
* @property string $tagMode
* @property Carbon|null $date
@ -76,7 +77,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @method static \Illuminate\Database\Eloquent\Builder|Tag whereZoomLevel($value)
* @method static Builder|Tag withTrashed()
* @method static Builder|Tag withoutTrashed()
* @property int $user_group_id
* @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Tag whereUserGroupId($value)
* @mixin Eloquent
*/

View File

@ -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
*
@ -42,12 +43,12 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property bool $reconciled
* @property int $account_id
* @property int $transaction_journal_id
* @property int $account_id
* @property int $transaction_journal_id
* @property string|null $description
* @property int|null $transaction_currency_id
* @property string|int|null $modified
* @property string|int|null $modified_foreign
* @property string|int|null $modified
* @property string|int|null $modified_foreign
* @property string $date
* @property string $max_date
* @property string $amount
@ -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
*/

View File

@ -84,7 +84,7 @@ class TransactionCurrency extends Model
public ?bool $userDefault;
public ?bool $userEnabled;
protected $casts
protected $casts
= [
'created_at' => 'datetime',
'updated_at' => 'datetime',

View File

@ -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
*
@ -42,7 +43,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $user_id
* @property string|null $title
* @property-read Collection|TransactionJournal[] $transactionJournals
* @property-read int|null $transaction_journals_count
@ -59,7 +60,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @method static \Illuminate\Database\Eloquent\Builder|TransactionGroup whereUserId($value)
* @method static Builder|TransactionGroup withTrashed()
* @method static Builder|TransactionGroup withoutTrashed()
* @property int $user_group_id
* @property int $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|TransactionGroup whereUserGroupId($value)
* @property-read UserGroup|null $userGroup
* @mixin Eloquent

View File

@ -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
*
@ -47,8 +48,8 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $transaction_type_id
* @property int $user_id
* @property int $transaction_type_id
* @property int|string|null $transaction_group_id
* @property int|string|null $bill_id
* @property int|string|null $transaction_currency_id
@ -117,7 +118,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property-read Collection|Location[] $locations
* @property-read int|null $locations_count
* @property int|string $the_count
* @property int $user_group_id
* @property int $user_group_id
* @method static EloquentBuilder|TransactionJournal whereUserGroupId($value)
* @property-read Collection<int, AuditLogEntry> $auditLogEntries
* @property-read int|null $audit_log_entries_count
@ -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,
);
}
}

View File

@ -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,14 +33,14 @@ 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
*
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $link_type_id
* @property int $link_type_id
* @property int $source_id
* @property int $destination_id
* @property string|null $comment
@ -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,
);
}
}

View File

@ -25,19 +25,20 @@ 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
*
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property int $transaction_journal_id
* @property int $transaction_journal_id
* @property string $name
* @property mixed $data
* @property string $hash
@ -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
*/

View File

@ -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
*

View File

@ -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
*

View File

@ -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
*

View File

@ -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
*
@ -45,7 +46,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $user_id
* @property bool $active
* @property int $trigger
* @property int $response
@ -74,7 +75,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property string $secret
* @method static Builder|Webhook whereSecret($value)
* @method static Builder|Webhook whereTitle($value)
* @property int $user_group_id
* @property int $user_group_id
* @method static Builder|Webhook whereUserGroupId($value)
* @mixin Eloquent
*/

View File

@ -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
*
@ -40,7 +41,7 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $deleted_at
* @property int $webhook_message_id
* @property int $webhook_message_id
* @property int|string $status_code
* @property string|null $logs
* @property string|null $response

Some files were not shown because too many files have changed in this diff Show More