Make sure all objects also add user group

This commit is contained in:
James Cole
2023-08-11 19:37:28 +02:00
parent e1ba2d9ad9
commit a9bd0f551d
20 changed files with 60 additions and 38 deletions

View File

@@ -125,9 +125,9 @@ class Account extends Model
'encrypted' => 'boolean',
];
/** @var array Fields that can be filled */
protected $fillable = ['user_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
protected $fillable = ['user_id', 'user_group_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
/** @var array Hidden from view */
protected $hidden = ['encrypted'];
protected $hidden = ['encrypted'];
private bool $joinedAccountTypes = false;
/**
@@ -291,7 +291,7 @@ class Account extends Model
protected function virtualBalance(): Attribute
{
return Attribute::make(
get: fn ($value) => (string)$value,
get: fn($value) => (string)$value,
);
}
}

View File

@@ -85,7 +85,7 @@ class AvailableBudget extends Model
'transaction_currency_id' => 'int',
];
/** @var array Fields that can be filled */
protected $fillable = ['user_id', 'transaction_currency_id', 'amount', 'start_date', 'end_date'];
protected $fillable = ['user_id', 'user_group_id', 'transaction_currency_id', 'amount', 'start_date', 'end_date'];
/**
* Route binder. Converts the key in the URL to the specified object (or throw 404).
@@ -132,7 +132,7 @@ class AvailableBudget extends Model
protected function amount(): Attribute
{
return Attribute::make(
get: fn ($value) => (string)$value,
get: fn($value) => (string)$value,
);
}
}

View File

@@ -130,6 +130,7 @@ class Bill extends Model
'match',
'amount_min',
'user_id',
'user_group_id',
'amount_max',
'date',
'repeat_freq',
@@ -241,7 +242,7 @@ class Bill extends Model
protected function amountMax(): Attribute
{
return Attribute::make(
get: fn ($value) => (string)$value,
get: fn($value) => (string)$value,
);
}
@@ -253,7 +254,7 @@ class Bill extends Model
protected function amountMin(): Attribute
{
return Attribute::make(
get: fn ($value) => (string)$value,
get: fn($value) => (string)$value,
);
}
}

View File

@@ -89,7 +89,7 @@ class Category extends Model
'encrypted' => 'boolean',
];
/** @var array Fields that can be filled */
protected $fillable = ['user_id', 'name'];
protected $fillable = ['user_id', 'user_group_id', 'name'];
/** @var array Hidden from view */
protected $hidden = ['encrypted'];

View File

@@ -77,7 +77,7 @@ class ObjectGroup extends Model
'user_id' => 'integer',
'deleted_at' => 'datetime',
];
protected $fillable = ['title', 'order', 'user_id'];
protected $fillable = ['title', 'order', 'user_id', 'user_group_id'];
/**
* Route binder. Converts the key in the URL to the specified object (or throw 404).

View File

@@ -165,4 +165,12 @@ class Rule extends Model
{
$this->attributes['description'] = e($value);
}
/**
* @return BelongsTo
*/
public function userGroup(): BelongsTo
{
return $this->belongsTo(UserGroup::class);
}
}

View File

@@ -99,7 +99,7 @@ class Tag extends Model
'longitude' => 'float',
];
/** @var array Fields that can be filled */
protected $fillable = ['user_id', 'tag', 'date', 'description', 'tagMode'];
protected $fillable = ['user_id', 'user_group_id', 'tag', 'date', 'description', 'tagMode'];
protected $hidden = ['zoomLevel', 'latitude', 'longitude'];

View File

@@ -88,7 +88,7 @@ class Webhook extends Model
'response' => 'integer',
'delivery' => 'integer',
];
protected $fillable = ['active', 'trigger', 'response', 'delivery', 'user_id', 'url', 'title', 'secret'];
protected $fillable = ['active', 'trigger', 'response', 'delivery', 'user_id', 'user_group_id', 'url', 'title', 'secret'];
/**
* @return array