diff options
Diffstat (limited to 'main/app/sprinkles/account/src/Log/UserActivityDatabaseHandler.php')
-rw-r--r-- | main/app/sprinkles/account/src/Log/UserActivityDatabaseHandler.php | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/main/app/sprinkles/account/src/Log/UserActivityDatabaseHandler.php b/main/app/sprinkles/account/src/Log/UserActivityDatabaseHandler.php index a1cd14f..eb57f43 100644 --- a/main/app/sprinkles/account/src/Log/UserActivityDatabaseHandler.php +++ b/main/app/sprinkles/account/src/Log/UserActivityDatabaseHandler.php @@ -1,33 +1,33 @@ -<?php -/** - * UserFrosting (http://www.userfrosting.com) - * - * @link https://github.com/userfrosting/UserFrosting - * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License) - */ - -namespace UserFrosting\Sprinkle\Account\Log; - -use UserFrosting\Sprinkle\Core\Log\DatabaseHandler; - -/** - * Monolog handler for storing user activities to the database. - * - * @author Alex Weissman (https://alexanderweissman.com) - */ -class UserActivityDatabaseHandler extends DatabaseHandler -{ - /** - * {@inheritDoc} - */ - protected function write(array $record) { - $log = $this->classMapper->createInstance($this->modelName, $record['extra']); - $log->save(); - - if (isset($record['extra']['user_id'])) { - $user = $this->classMapper->staticMethod('user', 'find', $record['extra']['user_id']); - $user->last_activity_id = $log->id; - $user->save(); - } - } -} +<?php
+/**
+ * UserFrosting (http://www.userfrosting.com)
+ *
+ * @link https://github.com/userfrosting/UserFrosting
+ * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License)
+ */
+
+namespace UserFrosting\Sprinkle\Account\Log;
+
+use UserFrosting\Sprinkle\Core\Log\DatabaseHandler;
+
+/**
+ * Monolog handler for storing user activities to the database.
+ *
+ * @author Alex Weissman (https://alexanderweissman.com)
+ */
+class UserActivityDatabaseHandler extends DatabaseHandler
+{
+ /**
+ * {@inheritDoc}
+ */
+ protected function write(array $record) {
+ $log = $this->classMapper->createInstance($this->modelName, $record['extra']);
+ $log->save();
+
+ if (isset($record['extra']['user_id'])) {
+ $user = $this->classMapper->staticMethod('user', 'find', $record['extra']['user_id']);
+ $user->last_activity_id = $log->id;
+ $user->save();
+ }
+ }
+}
|