mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 00:27:30 +00:00
Auto commit for release 'develop' on 2024-07-29
This commit is contained in:
@@ -51,7 +51,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property null|Carbon $deleted_at
|
||||
* @property int $user_id
|
||||
* @property int $account_type_id
|
||||
* @property string $account_type_string
|
||||
* @property string $account_type_string
|
||||
* @property string $name
|
||||
* @property string $virtual_balance
|
||||
* @property null|string $iban
|
||||
@@ -76,7 +76,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property Collection|Transaction[] $transactions
|
||||
* @property null|int $transactions_count
|
||||
* @property User $user
|
||||
* @property string $last_activity
|
||||
* @property string $last_activity
|
||||
*
|
||||
* @method static EloquentBuilder|Account accountTypeIn($types)
|
||||
* @method static EloquentBuilder|Account newModelQuery()
|
||||
@@ -98,35 +98,35 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|Account withTrashed()
|
||||
* @method static Builder|Account withoutTrashed()
|
||||
*
|
||||
* @property Carbon $lastActivityDate
|
||||
* @property string $startBalance
|
||||
* @property string $endBalance
|
||||
* @property string $difference
|
||||
* @property string $interest
|
||||
* @property string $interestPeriod
|
||||
* @property string $accountTypeString
|
||||
* @property Location $location
|
||||
* @property string $liability_direction
|
||||
* @property string $current_debt
|
||||
* @property int $user_group_id
|
||||
* @property Carbon $lastActivityDate
|
||||
* @property string $startBalance
|
||||
* @property string $endBalance
|
||||
* @property string $difference
|
||||
* @property string $interest
|
||||
* @property string $interestPeriod
|
||||
* @property string $accountTypeString
|
||||
* @property Location $location
|
||||
* @property string $liability_direction
|
||||
* @property string $current_debt
|
||||
* @property int $user_group_id
|
||||
*
|
||||
* @method static EloquentBuilder|Account whereUserGroupId($value)
|
||||
*
|
||||
* @property null|UserGroup $userGroup
|
||||
* @property mixed $account_id
|
||||
* @property null|UserGroup $userGroup
|
||||
* @property mixed $account_id
|
||||
*
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class Account extends Model
|
||||
{
|
||||
use Cachable;
|
||||
use HasFactory;
|
||||
use ReturnsIntegerIdTrait;
|
||||
use ReturnsIntegerUserIdTrait;
|
||||
use SoftDeletes;
|
||||
use Cachable;
|
||||
|
||||
protected $casts
|
||||
= [
|
||||
= [
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'user_id' => 'integer',
|
||||
@@ -135,9 +135,9 @@ class Account extends Model
|
||||
'encrypted' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = ['user_id', 'user_group_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
|
||||
protected $fillable = ['user_id', 'user_group_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
|
||||
|
||||
protected $hidden = ['encrypted'];
|
||||
protected $hidden = ['encrypted'];
|
||||
private bool $joinedAccountTypes = false;
|
||||
|
||||
/**
|
||||
@@ -151,10 +151,10 @@ class Account extends Model
|
||||
$accountId = (int) $value;
|
||||
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$user = auth()->user();
|
||||
|
||||
/** @var null|Account $account */
|
||||
$account = $user->accounts()->with(['accountType'])->find($accountId);
|
||||
$account = $user->accounts()->with(['accountType'])->find($accountId);
|
||||
if (null !== $account) {
|
||||
return $account;
|
||||
}
|
||||
@@ -185,8 +185,9 @@ class Account extends Model
|
||||
{
|
||||
/** @var null|AccountMeta $metaValue */
|
||||
$metaValue = $this->accountMeta()
|
||||
->where('name', 'account_number')
|
||||
->first();
|
||||
->where('name', 'account_number')
|
||||
->first()
|
||||
;
|
||||
|
||||
return null !== $metaValue ? $metaValue->data : '';
|
||||
}
|
||||
@@ -249,7 +250,7 @@ class Account extends Model
|
||||
|
||||
public function setVirtualBalanceAttribute(mixed $value): void
|
||||
{
|
||||
$value = (string) $value;
|
||||
$value = (string) $value;
|
||||
if ('' === $value) {
|
||||
$value = null;
|
||||
}
|
||||
@@ -269,7 +270,7 @@ class Account extends Model
|
||||
protected function accountId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int) $value,
|
||||
get: static fn ($value) => (int) $value,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -279,21 +280,21 @@ class Account extends Model
|
||||
protected function accountTypeId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int) $value,
|
||||
get: static fn ($value) => (int) $value,
|
||||
);
|
||||
}
|
||||
|
||||
protected function iban(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => null === $value ? null : trim(str_replace(' ', '', (string) $value)),
|
||||
get: static fn ($value) => null === $value ? null : trim(str_replace(' ', '', (string) $value)),
|
||||
);
|
||||
}
|
||||
|
||||
protected function order(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int) $value,
|
||||
get: static fn ($value) => (int) $value,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -303,7 +304,7 @@ class Account extends Model
|
||||
protected function virtualBalance(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (string) $value,
|
||||
get: static fn ($value) => (string) $value,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user