mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 12:12:18 +00:00
Fix route in net worth and expand user group API
This commit is contained in:
@@ -29,6 +29,7 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
@@ -66,6 +67,8 @@ use Illuminate\Support\Carbon;
|
||||
*/
|
||||
class CurrencyExchangeRate extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
/** @var array Convert these fields to other data types */
|
||||
protected $casts
|
||||
= [
|
||||
@@ -108,7 +111,7 @@ class CurrencyExchangeRate extends Model
|
||||
protected function rate(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => (string)$value,
|
||||
get: fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -118,7 +121,7 @@ class CurrencyExchangeRate extends Model
|
||||
protected function userRate(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => (string)$value,
|
||||
get: fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -109,6 +109,16 @@ class UserGroup extends Model
|
||||
return $this->hasMany(Account::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Link to attachments.
|
||||
*
|
||||
* @return HasMany
|
||||
*/
|
||||
public function attachments(): HasMany
|
||||
{
|
||||
return $this->hasMany(Attachment::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Link to bills.
|
||||
*
|
||||
@@ -139,6 +149,26 @@ class UserGroup extends Model
|
||||
return $this->hasMany(Budget::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Link to categories.
|
||||
*
|
||||
* @return HasMany
|
||||
*/
|
||||
public function categories(): HasMany
|
||||
{
|
||||
return $this->hasMany(Category::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Link to exchange rates.
|
||||
*
|
||||
* @return HasMany
|
||||
*/
|
||||
public function currencyExchangeRates(): HasMany
|
||||
{
|
||||
return $this->hasMany(CurrencyExchangeRate::class);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return HasMany
|
||||
@@ -148,6 +178,14 @@ class UserGroup extends Model
|
||||
return $this->hasMany(GroupMembership::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany
|
||||
*/
|
||||
public function objectGroups(): HasMany
|
||||
{
|
||||
return $this->hasMany(ObjectGroup::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Link to piggy banks.
|
||||
*
|
||||
@@ -158,6 +196,46 @@ class UserGroup extends Model
|
||||
return $this->hasManyThrough(PiggyBank::class, Account::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany
|
||||
*/
|
||||
public function recurrences(): HasMany
|
||||
{
|
||||
return $this->hasMany(Recurrence::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany
|
||||
*/
|
||||
public function ruleGroups(): HasMany
|
||||
{
|
||||
return $this->hasMany(RuleGroup::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany
|
||||
*/
|
||||
public function rules(): HasMany
|
||||
{
|
||||
return $this->hasMany(Rule::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany
|
||||
*/
|
||||
public function tags(): HasMany
|
||||
{
|
||||
return $this->hasMany(Tag::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany
|
||||
*/
|
||||
public function transactionGroups(): HasMany
|
||||
{
|
||||
return $this->hasMany(TransactionGroup::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Link to transaction journals.
|
||||
*
|
||||
@@ -167,4 +245,12 @@ class UserGroup extends Model
|
||||
{
|
||||
return $this->hasMany(TransactionJournal::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany
|
||||
*/
|
||||
public function webhooks(): HasMany
|
||||
{
|
||||
return $this->hasMany(Webhook::class);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user