Пример #1
0
 /**
  * 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);
 }
Пример #2
0
 /**
  * Saves the current resource object using the ResourceFactory class.
  * @return object
  */
 public function save()
 {
     return ResourceFactory::saveResource($this);
 }