Ejemplo n.º 1
0
 public static function log($user_id, $event, $params = null, $meta = null)
 {
     $e = new AnalyticsEvent();
     $e->user_id = $user_id;
     $e->name = $event;
     if (isset($meta['referrer'])) {
         $e->referrer = $meta['referrer'];
     }
     if (isset($meta['ip'])) {
         $e->ip = $meta['ip'];
     }
     if (isset($meta['client'])) {
         $e->client = $meta['client'];
     }
     $e->params = json_encode($params);
     $e->save();
     return 'ok';
 }
Ejemplo n.º 2
0
 public function getUserAnalytics($id)
 {
     $events = AnalyticsEvent::where('user_id', $id)->get();
     return $events;
 }