Mild code cleanup.

This commit is contained in:
James Cole
2024-11-06 12:01:29 +01:00
parent c398383905
commit b2d4469908
18 changed files with 40 additions and 39 deletions

View File

@@ -14,7 +14,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
class AccountBalance extends Model class AccountBalance extends Model
{ {
use HasFactory; use HasFactory;
protected $fillable = ['account_id', 'title', 'transaction_currency_id', 'balance','date','date_tz']; protected $fillable = ['account_id', 'title', 'transaction_currency_id', 'balance', 'date', 'date_tz'];
public function account(): BelongsTo public function account(): BelongsTo
{ {

View File

@@ -51,7 +51,7 @@ class AvailableBudget extends Model
'transaction_currency_id' => 'int', 'transaction_currency_id' => 'int',
]; ];
protected $fillable = ['user_id', 'user_group_id', 'transaction_currency_id', 'amount', 'start_date', 'end_date', 'start_date_tz','end_date_tz']; protected $fillable = ['user_id', 'user_group_id', 'transaction_currency_id', 'amount', 'start_date', 'end_date', 'start_date_tz', 'end_date_tz'];
/** /**
* Route binder. Converts the key in the URL to the specified object (or throw 404). * Route binder. Converts the key in the URL to the specified object (or throw 404).

View File

@@ -54,7 +54,7 @@ class BudgetLimit extends Model
'deleted' => Deleted::class, 'deleted' => Deleted::class,
]; ];
protected $fillable = ['budget_id', 'start_date', 'end_date','start_date_tz','end_date_tz', 'amount', 'transaction_currency_id']; protected $fillable = ['budget_id', 'start_date', 'end_date', 'start_date_tz', 'end_date_tz', 'amount', 'transaction_currency_id'];
/** /**
* Route binder. Converts the key in the URL to the specified object (or throw 404). * Route binder. Converts the key in the URL to the specified object (or throw 404).

View File

@@ -49,7 +49,7 @@ class CurrencyExchangeRate extends Model
'to_currency_id' => 'int', 'to_currency_id' => 'int',
'date' => 'datetime', 'date' => 'datetime',
]; ];
protected $fillable = ['user_id', 'from_currency_id', 'to_currency_id', 'date','date_tz', 'rate']; protected $fillable = ['user_id', 'from_currency_id', 'to_currency_id', 'date', 'date_tz', 'rate'];
public function fromCurrency(): BelongsTo public function fromCurrency(): BelongsTo
{ {

View File

@@ -44,7 +44,7 @@ class InvitedUser extends Model
'expires' => 'datetime', 'expires' => 'datetime',
'redeemed' => 'boolean', 'redeemed' => 'boolean',
]; ];
protected $fillable = ['user_id', 'email', 'invite_code', 'expires','expires_tz', 'redeemed']; protected $fillable = ['user_id', 'email', 'invite_code', 'expires', 'expires_tz', 'redeemed'];
/** /**
* Route binder. Converts the key in the URL to the specified object (or throw 404). * Route binder. Converts the key in the URL to the specified object (or throw 404).

View File

@@ -53,7 +53,7 @@ class PiggyBank extends Model
'encrypted' => 'boolean', 'encrypted' => 'boolean',
]; ];
protected $fillable = ['name', 'account_id', 'order', 'targetamount', 'startdate','startdate_tz', 'targetdate', 'targetdate_tz', 'active']; protected $fillable = ['name', 'account_id', 'order', 'targetamount', 'startdate', 'startdate_tz', 'targetdate', 'targetdate_tz', 'active'];
protected $hidden = ['targetamount_encrypted', 'encrypted']; protected $hidden = ['targetamount_encrypted', 'encrypted'];

View File

@@ -42,7 +42,7 @@ class PiggyBankEvent extends Model
'date' => 'date', 'date' => 'date',
]; ];
protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'date_tz','amount']; protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'date_tz', 'amount'];
protected $hidden = ['amount_encrypted']; protected $hidden = ['amount_encrypted'];

View File

@@ -45,7 +45,7 @@ class PiggyBankRepetition extends Model
'targetdate' => 'date', 'targetdate' => 'date',
]; ];
protected $fillable = ['piggy_bank_id', 'startdate','startdate_tz', 'targetdate','targetdate_tz', 'currentamount']; protected $fillable = ['piggy_bank_id', 'startdate', 'startdate_tz', 'targetdate', 'targetdate_tz', 'currentamount'];
public function piggyBank(): BelongsTo public function piggyBank(): BelongsTo
{ {

View File

@@ -60,7 +60,7 @@ class Recurrence extends Model
]; ];
protected $fillable protected $fillable
= ['user_id', 'transaction_type_id', 'title', 'description', 'first_date','first_date_tz', 'repeat_until','repeat_until_tz', 'latest_date','latest_date_tz', 'repetitions', 'apply_rules', 'active']; = ['user_id', 'transaction_type_id', 'title', 'description', 'first_date', 'first_date_tz', 'repeat_until', 'repeat_until_tz', 'latest_date', 'latest_date_tz', 'repetitions', 'apply_rules', 'active'];
/** @var string The table to store the data in */ /** @var string The table to store the data in */
protected $table = 'recurrences'; protected $table = 'recurrences';

View File

@@ -53,7 +53,7 @@ class Tag extends Model
'longitude' => 'float', 'longitude' => 'float',
]; ];
protected $fillable = ['user_id', 'user_group_id', 'tag', 'date','date_tz', 'description', 'tagMode']; protected $fillable = ['user_id', 'user_group_id', 'tag', 'date', 'date_tz', 'description', 'tagMode'];
protected $hidden = ['zoomLevel', 'latitude', 'longitude']; protected $hidden = ['zoomLevel', 'latitude', 'longitude'];

View File

@@ -109,6 +109,7 @@ class IsUniqueAccount implements ValidationRule, DataAwareRule
{ {
if (!array_key_exists('user_id', $this->data)) { if (!array_key_exists('user_id', $this->data)) {
$this->fail('No user ID provided.'); $this->fail('No user ID provided.');
return false; return false;
} }