mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 08:35:00 +00:00
Model updates for #3200
This commit is contained in:
@@ -143,6 +143,13 @@ class Account extends Model
|
|||||||
throw new NotFoundHttpException;
|
throw new NotFoundHttpException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all of the tags for the post.
|
||||||
|
*/
|
||||||
|
public function objectGroups()
|
||||||
|
{
|
||||||
|
return $this->morphToMany(ObjectGroup::class, 'object_groupable');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
|
@@ -85,6 +85,14 @@ class ObjectGroup extends Model
|
|||||||
return $this->morphedByMany(Bill::class, 'object_groupable');
|
return $this->morphedByMany(Bill::class, 'object_groupable');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany
|
||||||
|
*/
|
||||||
|
public function accounts()
|
||||||
|
{
|
||||||
|
return $this->morphedByMany(Account::class, 'object_groupable');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||||
*
|
*
|
||||||
@@ -97,6 +105,7 @@ class ObjectGroup extends Model
|
|||||||
{
|
{
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
$objectGroupId = (int) $value;
|
$objectGroupId = (int) $value;
|
||||||
|
/** @var ObjectGroup $objectGroup */
|
||||||
$objectGroup = self::where('object_groups.id', $objectGroupId)
|
$objectGroup = self::where('object_groups.id', $objectGroupId)
|
||||||
->where('object_groups.user_id', auth()->user()->id)->first();
|
->where('object_groups.user_id', auth()->user()->id)->first();
|
||||||
if (null !== $objectGroup) {
|
if (null !== $objectGroup) {
|
||||||
|
Reference in New Issue
Block a user