/** * Stamps the current datestamp and ip_address. */ public static function stampResource(\Resource $resource, $action) { $activity = new Activity(); $activity->class_name = $resource->getNamespace(); $activity->resource_id = $resource->getId(); $activity->action = $action; if (\User\Current::isLoggedIn()) { $activity->user_id = \User\Current::getUserId(); } try { $activity->ip_address = \Server::getUserIp(); } catch (Exception $e) { $activity->ip_address = '0.0.0.0'; \Error::log($e); } \ResourceFactory::saveResource($activity); }