Code cleanup

This commit is contained in:
James Cole
2024-12-22 08:43:12 +01:00
parent 5751f7e5a3
commit 565bd87959
574 changed files with 4600 additions and 4604 deletions

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Models;
use FireflyIII\Enums\AutoBudgetType;
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
@@ -47,12 +46,12 @@ class AutoBudget extends Model
#[\Deprecated]
public const int AUTO_BUDGET_ROLLOVER = 2;
protected $casts
= [
'amount' => 'string',
];
protected $fillable = ['budget_id', 'amount', 'period'];
protected $casts = [
'amount' => 'string',
];
public function budget(): BelongsTo
{
return $this->belongsTo(Budget::class);
@@ -63,6 +62,20 @@ class AutoBudget extends Model
return $this->belongsTo(TransactionCurrency::class);
}
protected function amount(): Attribute
{
return Attribute::make(
get: static fn ($value) => (string) $value,
);
}
protected function budgetId(): Attribute
{
return Attribute::make(
get: static fn ($value) => (int) $value,
);
}
protected function casts(): array
{
return [
@@ -70,24 +83,10 @@ class AutoBudget extends Model
];
}
protected function amount(): Attribute
{
return Attribute::make(
get: static fn ($value) => (string)$value,
);
}
protected function budgetId(): Attribute
{
return Attribute::make(
get: static fn ($value) => (int)$value,
);
}
protected function transactionCurrencyId(): Attribute
{
return Attribute::make(
get: static fn ($value) => (int)$value,
get: static fn ($value) => (int) $value,
);
}
}