Remove statistics when creating a new journal.

This commit is contained in:
James Cole
2025-09-26 19:38:26 +02:00
parent 8b09cfb8c9
commit 8f24ac4fcd
3 changed files with 32 additions and 8 deletions

View File

@@ -74,4 +74,9 @@ class PeriodStatisticRepository implements PeriodStatisticRepositoryInterface
{
return $model->primaryPeriodStatistics()->where('start', '>=', $start)->where('end', '<=', $end)->get();
}
public function deleteStatisticsForModel(Model $model, Carbon $date): void
{
$model->primaryPeriodStatistics()->where('start', '<=', $date)->where('end', '>=', $date)->delete();
}
}