public function handle_after_destroy() { $expense_id = $this->id; if (!is_null($expense_id)) { $t = Transaction::where_expense_id($expense_id)->first(); $transaction_id = $t->id; $b = Balance::where_transaction_id($transaction_id)->first(); if (!is_null($t) && !is_null($b)) { $b->delete(); $t->delete(); $t->update_later_balance(); } } }
public function handle_before_destroy() { $transaction_id = $this->id; if (!is_null($transaction_id)) { $b = Balance::where_transaction_id($transaction_id); return $b->delete(); } }