Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Small code cleanup
James Cole92f7a9c5742e
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.phpindex 94eae23c6b..ed1635f8d9 100644--- a/app/Models/TransactionJournal.php+++ b/app/Models/TransactionJournal.php@@ -28,6 +28,7 @@ use FireflyIII\Exceptions\FireflyException;use FireflyIII\User;use Illuminate\Database\Eloquent\Builder;use Illuminate\Database\Eloquent\Builder as EloquentBuilder;+use Illuminate\Database\Eloquent\Collection;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\Model;use Illuminate\Database\Eloquent\Relations\BelongsTo;@@ -40,52 +41,52 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/*** FireflyIII\Models\TransactionJournal*- * @property int $id- * @property \Carbon\Carbon|null $created_at- * @property \Carbon\Carbon|null $updated_at- * @property \Carbon\Carbon|null $deleted_at- * @property int $user_id- * @property int $transaction_type_id- * @property int|null $transaction_group_id- * @property int|null $bill_id- * @property int|null $transaction_currency_id- * @property string $description- * @property \Carbon\Carbon $date- * @property \Carbon\Carbon|null $interest_date- * @property \Carbon\Carbon|null $book_date- * @property \Carbon\Carbon|null $process_date- * @property int $order- * @property int $tag_count- * @property string $transaction_type_type- * @property bool $encrypted- * @property bool $completed- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Attachment[] $attachments- * @property-read int|null $attachments_count- * @property-read \FireflyIII\Models\Bill|null $bill- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets- * @property-read int|null $budgets_count- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Category[] $categories- * @property-read int|null $categories_count- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournalLink[] $destJournalLinks- * @property-read int|null $dest_journal_links_count- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Note[] $notes- * @property-read int|null $notes_count- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankEvent[] $piggyBankEvents- * @property-read int|null $piggy_bank_events_count- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournalLink[] $sourceJournalLinks- * @property-read int|null $source_journal_links_count- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Tag[] $tags- * @property-read int|null $tags_count- * @property-read \FireflyIII\Models\TransactionCurrency|null $transactionCurrency- * @property-read \FireflyIII\Models\TransactionGroup|null $transactionGroup- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournalMeta[] $transactionJournalMeta- * @property-read int|null $transaction_journal_meta_count- * @property-read \FireflyIII\Models\TransactionType $transactionType- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions- * @property-read int|null $transactions_count- * @property-read User $user- * @method static EloquentBuilder|TransactionJournal after(\Carbon\Carbon $date)- * @method static EloquentBuilder|TransactionJournal before(\Carbon\Carbon $date)+ * @property int $id+ * @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|null $transaction_group_id+ * @property int|null $bill_id+ * @property int|null $transaction_currency_id+ * @property string $description+ * @property Carbon $date+ * @property Carbon|null $interest_date+ * @property Carbon|null $book_date+ * @property Carbon|null $process_date+ * @property int $order+ * @property int $tag_count+ * @property string $transaction_type_type+ * @property bool $encrypted+ * @property bool $completed+ * @property-read Collection|Attachment[] $attachments+ * @property-read int|null $attachments_count+ * @property-read Bill|null $bill+ * @property-read Collection|Budget[] $budgets+ * @property-read int|null $budgets_count+ * @property-read Collection|Category[] $categories+ * @property-read int|null $categories_count+ * @property-read Collection|TransactionJournalLink[] $destJournalLinks+ * @property-read int|null $dest_journal_links_count+ * @property-read Collection|Note[] $notes+ * @property-read int|null $notes_count+ * @property-read Collection|PiggyBankEvent[] $piggyBankEvents+ * @property-read int|null $piggy_bank_events_count+ * @property-read Collection|TransactionJournalLink[] $sourceJournalLinks+ * @property-read int|null $source_journal_links_count+ * @property-read Collection|Tag[] $tags+ * @property-read int|null $tags_count+ * @property-read TransactionCurrency|null $transactionCurrency+ * @property-read TransactionGroup|null $transactionGroup+ * @property-read Collection|TransactionJournalMeta[] $transactionJournalMeta+ * @property-read int|null $transaction_journal_meta_count+ * @property-read TransactionType $transactionType+ * @property-read Collection|Transaction[] $transactions+ * @property-read int|null $transactions_count+ * @property-read User $user+ * @method static EloquentBuilder|TransactionJournal after(Carbon $date)+ * @method static EloquentBuilder|TransactionJournal before(Carbon $date)* @method static EloquentBuilder|TransactionJournal newModelQuery()* @method static EloquentBuilder|TransactionJournal newQuery()* @method static \Illuminate\Database\Query\Builder|TransactionJournal onlyTrashed()@@ -112,9 +113,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;* @method static \Illuminate\Database\Query\Builder|TransactionJournal withTrashed()* @method static \Illuminate\Database\Query\Builder|TransactionJournal withoutTrashed()* @mixin Eloquent- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Location[] $locations- * @property-read int|null $locations_count- * @property int $the_count+ * @property-read Collection|Location[] $locations+ * @property-read int|null $locations_count+ * @property int $the_count*/class TransactionJournal extends Model{@@ -147,31 +148,6 @@ class TransactionJournal extends Model/** @var array Hidden from view */protected $hidden = ['encrypted'];- /**- * Checks if tables are joined.- *- * @codeCoverageIgnore- *- * @param Builder $query- * @param string $table- *- * @return bool- */- public static function isJoined(Builder $query, string $table): bool- {- $joins = $query->getQuery()->joins;- if (null === $joins) {- return false;- }- foreach ($joins as $join) {- if ($join->table === $table) {- return true;- }- }-- return false;- }-/*** Route binder. Converts the key in the URL to the specified object (or throw 404).*@@ -215,15 +191,6 @@ class TransactionJournal extends Modelreturn $this->belongsTo(Bill::class);}- /**- * @codeCoverageIgnore- * @return MorphMany- */- public function locations(): MorphMany- {- return $this->morphMany(Location::class, 'locatable');- }-/*** @codeCoverageIgnore* @return BelongsToMany@@ -264,6 +231,15 @@ class TransactionJournal extends Modelreturn $this->transactionType->isTransfer();}+ /**+ * @codeCoverageIgnore+ * @return MorphMany+ */+ public function locations(): MorphMany+ {+ return $this->morphMany(Location::class, 'locatable');+ }+/*** @codeCoverageIgnore* Get all of the notes.@@ -324,6 +300,31 @@ class TransactionJournal extends Model}}+ /**+ * Checks if tables are joined.+ *+ * @codeCoverageIgnore+ *+ * @param Builder $query+ * @param string $table+ *+ * @return bool+ */+ public static function isJoined(Builder $query, string $table): bool+ {+ $joins = $query->getQuery()->joins;+ if (null === $joins) {+ return false;+ }+ foreach ($joins as $join) {+ if ($join->table === $table) {+ return true;+ }+ }++ return false;+ }+/*** @codeCoverageIgnore* @return HasMany