Skip to content

Firefly III: a personal finances manager

Clean up models.

James Cole7e6cd772036f
diff --git a/app/Models/Account.php b/app/Models/Account.php
index d3050b6a6e..c28e5408de 100644
--- a/app/Models/Account.php
+++ b/app/Models/Account.php
@@ -85,6 +85,15 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|Account withTrashed()
* @method static Builder|Account withoutTrashed()
* @mixin Eloquent
+ * @property-read int|null $account_meta_count
+ * @property-read \Illuminate\Database\Eloquent\Collection|Attachment[] $attachments
+ * @property-read int|null $attachments_count
+ * @property-read string $account_number
+ * @property-read \Illuminate\Database\Eloquent\Collection|Location[] $locations
+ * @property-read int|null $locations_count
+ * @property-read int|null $notes_count
+ * @property-read int|null $piggy_banks_count
+ * @property-read int|null $transactions_count
*/
class Account extends Model
{
diff --git a/app/Models/AccountType.php b/app/Models/AccountType.php
index 0debf344a7..4fe4e4ee9b 100644
--- a/app/Models/AccountType.php
+++ b/app/Models/AccountType.php
@@ -32,11 +32,11 @@ use Illuminate\Support\Carbon;
/**
* Class AccountType.
*
- * @property string $type
+ * @property string $type
* @method whereType(string $type)
- * @property int $id
- * @property Carbon|null $created_at
- * @property Carbon|null $updated_at
+ * @property int $id
+ * @property Carbon|null $created_at
+ * @property Carbon|null $updated_at
* @property-read Collection|Account[] $accounts
* @method static Builder|AccountType newModelQuery()
* @method static Builder|AccountType newQuery()
@@ -45,6 +45,7 @@ use Illuminate\Support\Carbon;
* @method static Builder|AccountType whereId($value)
* @method static Builder|AccountType whereUpdatedAt($value)
* @mixin Eloquent
+ * @property-read int|null $accounts_count
*/
class AccountType extends Model
{
diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php
index a885ff1505..34d997b92c 100644
--- a/app/Models/Attachment.php
+++ b/app/Models/Attachment.php
@@ -78,6 +78,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|Attachment withTrashed()
* @method static Builder|Attachment withoutTrashed()
* @mixin Eloquent
+ * @property-read int|null $notes_count
*/
class Attachment extends Model
{
diff --git a/app/Models/AutoBudget.php b/app/Models/AutoBudget.php
index 4d9dd6c834..f8ba614ddf 100644
--- a/app/Models/AutoBudget.php
+++ b/app/Models/AutoBudget.php
@@ -21,12 +21,45 @@
namespace FireflyIII\Models;
+use Eloquent;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
+use Illuminate\Database\Query\Builder;
+use Illuminate\Support\Carbon;
/**
* Class AutoBudget
+ *
+ * @property int $id
+ * @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 $auto_budget_type
+ * @property float $amount
+ * @property string $period
+ * @property-read Budget $budget
+ * @property-read TransactionCurrency $transactionCurrency
+ * @method static bool|null forceDelete()
+ * @method static \Illuminate\Database\Eloquent\Builder|AutoBudget newModelQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|AutoBudget newQuery()
+ * @method static Builder|AutoBudget onlyTrashed()
+ * @method static \Illuminate\Database\Eloquent\Builder|AutoBudget query()
+ * @method static bool|null restore()
+ * @method static \Illuminate\Database\Eloquent\Builder|AutoBudget whereAmount($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|AutoBudget whereAutoBudgetType($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|AutoBudget whereBudgetId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|AutoBudget whereCreatedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|AutoBudget whereDeletedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|AutoBudget whereId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|AutoBudget wherePeriod($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|AutoBudget whereTransactionCurrencyId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|AutoBudget whereUpdatedAt($value)
+ * @method static Builder|AutoBudget withTrashed()
+ * @method static Builder|AutoBudget withoutTrashed()
+ * @mixin Eloquent
*/
class AutoBudget extends Model
{
diff --git a/app/Models/Bill.php b/app/Models/Bill.php
index d4d1c5bdca..1b47e30d5c 100644
--- a/app/Models/Bill.php
+++ b/app/Models/Bill.php
@@ -86,6 +86,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|Bill withTrashed()
* @method static Builder|Bill withoutTrashed()
* @mixin Eloquent
+ * @property-read int|null $attachments_count
+ * @property-read int|null $notes_count
+ * @property-read int|null $transaction_journals_count
*/
class Bill extends Model
{
diff --git a/app/Models/Budget.php b/app/Models/Budget.php
index 92a56c92ac..5a977ebdf2 100644
--- a/app/Models/Budget.php
+++ b/app/Models/Budget.php
@@ -70,6 +70,13 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|Budget withTrashed()
* @method static Builder|Budget withoutTrashed()
* @mixin Eloquent
+ * @property-read \Illuminate\Database\Eloquent\Collection|Attachment[] $attachments
+ * @property-read int|null $attachments_count
+ * @property-read \Illuminate\Database\Eloquent\Collection|AutoBudget[] $autoBudgets
+ * @property-read int|null $auto_budgets_count
+ * @property-read int|null $budgetlimits_count
+ * @property-read int|null $transaction_journals_count
+ * @property-read int|null $transactions_count
*/
class Budget extends Model
{
diff --git a/app/Models/Category.php b/app/Models/Category.php
index c18e2396a6..48640838c6 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -66,6 +66,10 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|Category withTrashed()
* @method static Builder|Category withoutTrashed()
* @mixin Eloquent
+ * @property-read Collection|Attachment[] $attachments
+ * @property-read int|null $attachments_count
+ * @property-read int|null $transaction_journals_count
+ * @property-read int|null $transactions_count
*/
class Category extends Model
{
diff --git a/app/Models/ImportJob.php b/app/Models/ImportJob.php
index 774e784c37..e23bc0eae7 100644
--- a/app/Models/ImportJob.php
+++ b/app/Models/ImportJob.php
@@ -37,12 +37,12 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
*
* @codeCoverageIgnore
* @deprecated
- * @property array $transactions
- * @property array $configuration
- * @property User $user
- * @property int $user_id
- * @property string $status
- * @property string $stage
+ * @property array $transactions
+ * @property array $configuration
+ * @property User $user
+ * @property int $user_id
+ * @property string $status
+ * @property string $stage
* @property string $key
* @property string $provider
* @property string $file_type
@@ -72,6 +72,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|ImportJob whereUpdatedAt($value)
* @method static Builder|ImportJob whereUserId($value)
* @mixin Eloquent
+ * @property-read int|null $attachments_count
*/
class ImportJob extends Model
{
diff --git a/app/Models/LinkType.php b/app/Models/LinkType.php
index c9e941308e..657651961e 100644
--- a/app/Models/LinkType.php
+++ b/app/Models/LinkType.php
@@ -62,6 +62,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|LinkType withTrashed()
* @method static Builder|LinkType withoutTrashed()
* @mixin Eloquent
+ * @property-read int|null $transaction_journal_links_count
*/
class LinkType extends Model
{
diff --git a/app/Models/Location.php b/app/Models/Location.php
index 78b267f0c5..b8daa02010 100644
--- a/app/Models/Location.php
+++ b/app/Models/Location.php
@@ -22,12 +22,42 @@
namespace FireflyIII\Models;
+use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\Relations\MorphTo;
+use Illuminate\Support\Carbon;
/**
* Class Location
+ *
+ * @property int $id
+ * @property Carbon|null $created_at
+ * @property Carbon|null $updated_at
+ * @property Carbon|null $deleted_at
+ * @property int $locatable_id
+ * @property string $locatable_type
+ * @property float|null $latitude
+ * @property float|null $longitude
+ * @property int|null $zoom_level
+ * @property-read Collection|Account[] $accounts
+ * @property-read int|null $accounts_count
+ * @property-read Model|Eloquent $locatable
+ * @method static Builder|Location newModelQuery()
+ * @method static Builder|Location newQuery()
+ * @method static Builder|Location query()
+ * @method static Builder|Location whereCreatedAt($value)
+ * @method static Builder|Location whereDeletedAt($value)
+ * @method static Builder|Location whereId($value)
+ * @method static Builder|Location whereLatitude($value)
+ * @method static Builder|Location whereLocatableId($value)
+ * @method static Builder|Location whereLocatableType($value)
+ * @method static Builder|Location whereLongitude($value)
+ * @method static Builder|Location whereUpdatedAt($value)
+ * @method static Builder|Location whereZoomLevel($value)
+ * @mixin Eloquent
*/
class Location extends Model
{
diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php
index d658a51b22..732cb98c98 100644
--- a/app/Models/PiggyBank.php
+++ b/app/Models/PiggyBank.php
@@ -73,6 +73,11 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|PiggyBank withTrashed()
* @method static Builder|PiggyBank withoutTrashed()
* @mixin Eloquent
+ * @property-read Collection|Attachment[] $attachments
+ * @property-read int|null $attachments_count
+ * @property-read int|null $notes_count
+ * @property-read int|null $piggy_bank_events_count
+ * @property-read int|null $piggy_bank_repetitions_count
*/
class PiggyBank extends Model
{
diff --git a/app/Models/Recurrence.php b/app/Models/Recurrence.php
index 0d38528aa5..59444cfaf1 100644
--- a/app/Models/Recurrence.php
+++ b/app/Models/Recurrence.php
@@ -87,6 +87,10 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|Recurrence withTrashed()
* @method static Builder|Recurrence withoutTrashed()
* @mixin Eloquent
+ * @property-read int|null $notes_count
+ * @property-read int|null $recurrence_meta_count
+ * @property-read int|null $recurrence_repetitions_count
+ * @property-read int|null $recurrence_transactions_count
*/
class Recurrence extends Model
{
diff --git a/app/Models/RecurrenceTransaction.php b/app/Models/RecurrenceTransaction.php
index 3879a7794f..cc07306bd9 100644
--- a/app/Models/RecurrenceTransaction.php
+++ b/app/Models/RecurrenceTransaction.php
@@ -75,6 +75,7 @@ use Illuminate\Support\Collection;
* @method static Builder|RecurrenceTransaction withTrashed()
* @method static Builder|RecurrenceTransaction withoutTrashed()
* @mixin Eloquent
+ * @property-read int|null $recurrence_transaction_meta_count
*/
class RecurrenceTransaction extends Model
{
diff --git a/app/Models/Role.php b/app/Models/Role.php
index d573316ec8..0f81e1d5e6 100644
--- a/app/Models/Role.php
+++ b/app/Models/Role.php
@@ -50,6 +50,7 @@ use Illuminate\Support\Carbon;
* @method static Builder|Role whereName($value)
* @method static Builder|Role whereUpdatedAt($value)
* @mixin Eloquent
+ * @property-read int|null $users_count
*/
class Role extends Model
{
diff --git a/app/Models/Rule.php b/app/Models/Rule.php
index c2f0295382..fdd3ff7120 100644
--- a/app/Models/Rule.php
+++ b/app/Models/Rule.php
@@ -73,6 +73,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|Rule withTrashed()
* @method static Builder|Rule withoutTrashed()
* @mixin Eloquent
+ * @property-read int|null $rule_actions_count
+ * @property-read int|null $rule_triggers_count
*/
class Rule extends Model
{
diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.php
index fd9c13208c..bdc08ea3c6 100644
--- a/app/Models/RuleGroup.php
+++ b/app/Models/RuleGroup.php
@@ -67,6 +67,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|RuleGroup withoutTrashed()
* @property bool $stop_processing
* @mixin Eloquent
+ * @property-read int|null $rules_count
+ * @method static \Illuminate\Database\Eloquent\Builder|RuleGroup whereStopProcessing($value)
*/
class RuleGroup extends Model
{
diff --git a/app/Models/Tag.php b/app/Models/Tag.php
index e24381a493..1a7834771e 100644
--- a/app/Models/Tag.php
+++ b/app/Models/Tag.php
@@ -73,6 +73,11 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|Tag withTrashed()
* @method static Builder|Tag withoutTrashed()
* @mixin Eloquent
+ * @property-read \Illuminate\Database\Eloquent\Collection|Attachment[] $attachments
+ * @property-read int|null $attachments_count
+ * @property-read \Illuminate\Database\Eloquent\Collection|Location[] $locations
+ * @property-read int|null $locations_count
+ * @property-read int|null $transaction_journals_count
*/
class Tag extends Model
{
diff --git a/app/Models/Telemetry.php b/app/Models/Telemetry.php
index 203f467cc8..223b5d9137 100644
--- a/app/Models/Telemetry.php
+++ b/app/Models/Telemetry.php
@@ -22,10 +22,36 @@
namespace FireflyIII\Models;
+use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
/**
* Class Telemetry
+ *
+ * @property int $id
+ * @property Carbon|null $created_at
+ * @property Carbon|null $updated_at
+ * @property Carbon|null $submitted
+ * @property int|null $user_id
+ * @property string $installation_id
+ * @property string $type
+ * @property string $key
+ * @property array $value
+ * @method static Builder|Telemetry newModelQuery()
+ * @method static Builder|Telemetry newQuery()
+ * @method static Builder|Telemetry query()
+ * @method static Builder|Telemetry whereCreatedAt($value)
+ * @method static Builder|Telemetry whereId($value)
+ * @method static Builder|Telemetry whereInstallationId($value)
+ * @method static Builder|Telemetry whereKey($value)
+ * @method static Builder|Telemetry whereSubmitted($value)
+ * @method static Builder|Telemetry whereType($value)
+ * @method static Builder|Telemetry whereUpdatedAt($value)
+ * @method static Builder|Telemetry whereUserId($value)
+ * @method static Builder|Telemetry whereValue($value)
+ * @mixin Eloquent
*/
class Telemetry extends Model
{
diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php
index 1d77960197..b49c1157b6 100644
--- a/app/Models/Transaction.php
+++ b/app/Models/Transaction.php
@@ -130,6 +130,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Query\Builder|Transaction withTrashed()
* @method static \Illuminate\Database\Query\Builder|Transaction withoutTrashed()
* @mixin Eloquent
+ * @property-read int|null $budgets_count
+ * @property-read int|null $categories_count
*/
class Transaction extends Model
{
diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php
index 35aad46c89..5b05bc9cd5 100644
--- a/app/Models/TransactionCurrency.php
+++ b/app/Models/TransactionCurrency.php
@@ -64,6 +64,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|TransactionCurrency withTrashed()
* @method static Builder|TransactionCurrency withoutTrashed()
* @mixin Eloquent
+ * @property-read int|null $budget_limits_count
+ * @property-read int|null $transaction_journals_count
+ * @property-read int|null $transactions_count
*/
class TransactionCurrency extends Model
{
diff --git a/app/Models/TransactionGroup.php b/app/Models/TransactionGroup.php
index d3a25c15c2..d3ffdb2fbd 100644
--- a/app/Models/TransactionGroup.php
+++ b/app/Models/TransactionGroup.php
@@ -60,11 +60,12 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|TransactionGroup withTrashed()
* @method static Builder|TransactionGroup withoutTrashed()
* @mixin Eloquent
- * @property string amount
- * @property string foreign_amount
- * @property int transaction_group_id
- * @property int transaction_journal_id
- * @property string transaction_group_title
+ * @property string amount
+ * @property string foreign_amount
+ * @property int transaction_group_id
+ * @property int transaction_journal_id
+ * @property string transaction_group_title
+ * @property-read int|null $transaction_journals_count
*/
class TransactionGroup extends Model
{
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index 4ef492f952..74e548e7c7 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -109,6 +109,18 @@ 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 int|null $attachments_count
+ * @property-read int|null $budgets_count
+ * @property-read int|null $categories_count
+ * @property-read \Illuminate\Database\Eloquent\Collection|TransactionJournalLink[] $destJournalLinks
+ * @property-read int|null $dest_journal_links_count
+ * @property-read int|null $notes_count
+ * @property-read int|null $piggy_bank_events_count
+ * @property-read int|null $source_journal_links_count
+ * @property-read int|null $tags_count
+ * @property-read int|null $transaction_journal_meta_count
+ * @property-read int|null $transactions_count
+ * @method static EloquentBuilder|TransactionJournal whereTransactionGroupId($value)
*/
class TransactionJournal extends Model
{
diff --git a/app/Models/TransactionJournalLink.php b/app/Models/TransactionJournalLink.php
index 2b421f0488..98fc404e33 100644
--- a/app/Models/TransactionJournalLink.php
+++ b/app/Models/TransactionJournalLink.php
@@ -56,6 +56,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|TransactionJournalLink whereSourceId($value)
* @method static Builder|TransactionJournalLink whereUpdatedAt($value)
* @mixin Eloquent
+ * @property-read int|null $notes_count
*/
class TransactionJournalLink extends Model
{
diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php
index d99db5aade..6d45a09778 100644
--- a/app/Models/TransactionType.php
+++ b/app/Models/TransactionType.php
@@ -54,6 +54,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|TransactionType withTrashed()
* @method static Builder|TransactionType withoutTrashed()
* @mixin Eloquent
+ * @property-read int|null $transaction_journals_count
*/
class TransactionType extends Model
{