mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-01-17 13:38:20 +01:00
Delete related points when deleting metrics
This commit is contained in:
parent
cb5aac9637
commit
027b2e13e9
@ -141,6 +141,21 @@ class Metric extends Model implements HasPresenter
|
||||
'visible',
|
||||
];
|
||||
|
||||
/**
|
||||
* Overrides the models boot method.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
// When deleting a metric, delete the points too.
|
||||
self::deleting(function ($model) {
|
||||
$model->points()->delete();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the points relation.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user