Expand services.

This commit is contained in:
James Cole
2018-02-21 18:42:15 +01:00
parent 9f37bf5875
commit 81221038f0
10 changed files with 111 additions and 33 deletions

View File

@@ -122,20 +122,7 @@ class EventServiceProvider extends ServiceProvider
*/
protected function registerDeleteEvents()
{
Account::deleted(
function (Account $account) {
Log::debug('Now trigger account delete response #' . $account->id);
/** @var Transaction $transaction */
foreach ($account->transactions()->get() as $transaction) {
Log::debug('Now at transaction #' . $transaction->id);
$journal = $transaction->transactionJournal()->first();
if (null !== $journal) {
Log::debug('Call for deletion of journal #' . $journal->id);
$journal->delete();
}
}
}
);
TransactionJournal::deleted(
function (TransactionJournal $journal) {