Exemplo n.º 1
0
 public function errors()
 {
     return View::make('pragmarx/tracker::errors')->with('error_log', Tracker::errors(60 * 24 * Session::get('tracker.stats.days')))->with('title', 'Errors');
 }
Exemplo n.º 2
0
 public function apiVisits()
 {
     $username_column = Tracker::getConfig('authenticated_user_username_column');
     $query = Tracker::sessions($this->minutes, false);
     $query->select(array('id', 'uuid', 'user_id', 'device_id', 'agent_id', 'client_ip', 'referer_id', 'cookie_id', 'geoip_id', 'is_robot', 'updated_at'));
     return Datatables::of($query)->edit_column('id', function ($row) use($username_column) {
         $uri = route('tracker.stats.log', $row->uuid);
         return '<a href="' . $uri . '">' . $row->id . '</a>';
     })->add_column('country', function ($row) {
         $cityName = $row->geoip && $row->geoip->city ? ' - ' . $row->geoip->city : '';
         $countryName = ($row->geoip ? $row->geoip->country_name : '') . $cityName;
         $countryCode = strtolower($row->geoip ? $row->geoip->country_code : '');
         $flag = $countryCode ? "<span class=\"f16\"><span class=\"flag {$countryCode}\" alt=\"{$countryName}\" /></span></span>" : '';
         return "{$flag} {$countryName}";
     })->add_column('user', function ($row) use($username_column) {
         return $row->user ? $row->user->{$username_column} : 'guest';
     })->add_column('device', function ($row) use($username_column) {
         $model = $row->device && $row->device->model && $row->device->model !== 'unavailable' ? '[' . $row->device->model . ']' : '';
         $platform = $row->device && $row->device->platform ? ' [' . trim($row->device->platform . ' ' . $row->device->platform_version) . ']' : '';
         $mobile = $row->device && $row->device->is_mobile ? ' [mobile device]' : '';
         return $model || $platform || $mobile ? $row->device->kind . ' ' . $model . ' ' . $platform . ' ' . $mobile : '';
     })->add_column('browser', function ($row) use($username_column) {
         return $row->agent && $row->agent ? $row->agent->browser . ' (' . $row->agent->browser_version . ')' : '';
     })->add_column('referer', function ($row) use($username_column) {
         return $row->referer ? $row->referer->domain->name : '';
     })->add_column('pageViews', function ($row) use($username_column) {
         return $row->page_views;
     })->add_column('lastActivity', function ($row) use($username_column) {
         return $row->updated_at->diffForHumans();
     })->make(true);
 }
 /**
  * Reverse the migrations via migrator.
  *
  * @return void
  */
 public function down()
 {
     Tracker::getMigrator()->down();
 }