mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
can edit, delete and see in api autobudget
This commit is contained in:
@@ -49,12 +49,18 @@ class BudgetDestroyService
|
||||
*/
|
||||
public function destroy(Budget $budget): void
|
||||
{
|
||||
|
||||
try {
|
||||
$budget->delete();
|
||||
} catch (Exception $e) { // @codeCoverageIgnore
|
||||
Log::error(sprintf('Could not delete budget: %s', $e->getMessage())); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
// also delete auto budget:
|
||||
foreach ($budget->autoBudgets()->get() as $autoBudget) {
|
||||
$autoBudget->delete();
|
||||
}
|
||||
|
||||
// also delete all relations between categories and transaction journals:
|
||||
DB::table('budget_transaction_journal')->where('budget_id', (int)$budget->id)->delete();
|
||||
|
||||
|
Reference in New Issue
Block a user