Listen to the logout event. #219

This commit is contained in:
James Cole
2016-03-19 16:24:47 +01:00
parent 0404735ccb
commit 3d1dfe20b3

View File

@@ -32,20 +32,20 @@ class EventServiceProvider extends ServiceProvider
= [ = [
'FireflyIII\Events\TransactionJournalUpdated' => [ 'FireflyIII\Events\TransactionJournalUpdated' => [
'FireflyIII\Handlers\Events\ScanForBillsAfterUpdate', 'FireflyIII\Handlers\Events\ScanForBillsAfterUpdate',
'FireflyIII\Handlers\Events\UpdateJournalConnection', 'FireflyIII\Handlers\Events\UpdateJournalConnection',
'FireflyIII\Handlers\Events\FireRulesForUpdate', 'FireflyIII\Handlers\Events\FireRulesForUpdate',
], ],
'FireflyIII\Events\TransactionJournalStored' => [ 'FireflyIII\Events\TransactionJournalStored' => [
'FireflyIII\Handlers\Events\ScanForBillsAfterStore', 'FireflyIII\Handlers\Events\ScanForBillsAfterStore',
'FireflyIII\Handlers\Events\ConnectJournalToPiggyBank', 'FireflyIII\Handlers\Events\ConnectJournalToPiggyBank',
'FireflyIII\Handlers\Events\FireRulesForStore', 'FireflyIII\Handlers\Events\FireRulesForStore',
], ],
'Illuminate\Auth\Events\Logout' => [
'FireflyIII\Handlers\Events\UserEventListener@onUserLogout',
],
]; ];
/** /**
* Register any other events for your application. * Register any other events for your application.
* *
@@ -93,6 +93,26 @@ class EventServiceProvider extends ServiceProvider
// //
} }
/**
*
*/
protected function registerCreateEvents()
{
// move this routine to a filter
// in case of repeated piggy banks and/or other problems.
PiggyBank::created(
function (PiggyBank $piggyBank) {
$repetition = new PiggyBankRepetition;
$repetition->piggyBank()->associate($piggyBank);
$repetition->startdate = is_null($piggyBank->startdate) ? null : $piggyBank->startdate;
$repetition->targetdate = is_null($piggyBank->targetdate) ? null : $piggyBank->targetdate;
$repetition->currentamount = 0;
$repetition->save();
}
);
}
/** /**
* *
*/ */
@@ -121,24 +141,4 @@ class EventServiceProvider extends ServiceProvider
} }
/**
*
*/
protected function registerCreateEvents()
{
// move this routine to a filter
// in case of repeated piggy banks and/or other problems.
PiggyBank::created(
function (PiggyBank $piggyBank) {
$repetition = new PiggyBankRepetition;
$repetition->piggyBank()->associate($piggyBank);
$repetition->startdate = is_null($piggyBank->startdate) ? null : $piggyBank->startdate;
$repetition->targetdate = is_null($piggyBank->targetdate) ? null : $piggyBank->targetdate;
$repetition->currentamount = 0;
$repetition->save();
}
);
}
} }