mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Refactor models.
This commit is contained in:
@@ -87,30 +87,11 @@ class Rule extends Model
|
||||
return $this->hasMany(RuleTrigger::class);
|
||||
}
|
||||
|
||||
protected function description(): Attribute
|
||||
{
|
||||
return Attribute::make(set: fn($value) => ['description' => e($value)]);
|
||||
}
|
||||
|
||||
public function userGroup(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(UserGroup::class);
|
||||
}
|
||||
|
||||
protected function order(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
|
||||
protected function ruleGroupId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
@@ -126,4 +107,23 @@ class Rule extends Model
|
||||
'user_group_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
protected function description(): Attribute
|
||||
{
|
||||
return Attribute::make(set: fn($value) => ['description' => e($value)]);
|
||||
}
|
||||
|
||||
protected function order(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
|
||||
protected function ruleGroupId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user