Various code cleanup.

This commit is contained in:
James Cole
2023-11-05 19:41:37 +01:00
parent a0564751d6
commit 1d2e95f5af
136 changed files with 1171 additions and 514 deletions

View File

@@ -35,20 +35,20 @@ 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
*
* @property int|string $id
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int|string $account_id
* @property int $account_id
* @property string $name
* @property string|float $targetamount
* @property string $targetamount
* @property Carbon|null $startdate
* @property Carbon|null $targetdate
* @property int|string $order
* @property int|string $order
* @property bool $active
* @property bool $encrypted
* @property-read Account $account
@@ -84,6 +84,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
*/
class PiggyBank extends Model
{
use ReturnsIntegerIdTrait;
use SoftDeletes;
protected $casts
@@ -192,4 +193,14 @@ class PiggyBank extends Model
get: static fn ($value) => (string)$value,
);
}
/**
* @return Attribute
*/
protected function accountId(): Attribute
{
return Attribute::make(
get: static fn($value) => (int)$value,
);
}
}