public function testRemoveAllListenersWithMultipleEvents() { $result = false; $callback = function () use(&$result) { $result = true; }; Events::on('foo', $callback); Events::on('bar', $callback); Events::removeAllListeners(); $this->assertEquals([], Events::listeners('foo')); $this->assertEquals([], Events::listeners('bar')); }
//-------------------------------------------------------------------- // Send New User Registration Email Events::on('didRegisterUser', function ($data) { if ($data['method'] != 'email') { return true; } return Mail::deliver('UserMailer:didRegister', [$data]); }, EVENTS_PRIORITY_NORMAL); //-------------------------------------------------------------------- // Send Forgotten Password email Events::on('didRemindUser', function ($user, $token) { return Mail::deliver('UserMailer:remindUser', [$user, $token]); }, EVENTS_PRIORITY_NORMAL); //-------------------------------------------------------------------- // Send Reset Password notice Events::on('didResetPassword', function ($user) { return Mail::deliver('UserMailer:resetPassword', [$user]); }, EVENTS_PRIORITY_NORMAL); //-------------------------------------------------------------------- // Cron Job Events //-------------------------------------------------------------------- // Send Cron Job Summary Email // Uncomment the following block to enable mailing of cron // task results to the email in application config as site.auth_email. /* Events::on('afterCron', function($output) { return Mail::queue('CronMailer:results', [$output]); }, EVENTS_PRIORITY_NORMAL); */