private function putStats($user)
 {
     $stats = Stats::create();
     $stats->user_id = $user->id;
     $device = $user->devices->first();
     $stats->device_nr = $device->device_nr;
     $stats->device_state = $device->state;
     $stats->save();
 }
 public function personal_stats_json($id)
 {
     $user = User::find($id);
     $stats = ['user' => ['weekend' => $user->stats()->weekend()->count(), 'weekdays' => $user->stats()->week()->count()], 'all_users' => ['weekend' => Stats::weekend()->where('user_id', '!=', Auth::user()->id)->count(), 'weekdays' => Stats::week()->where('user_id', '!=', Auth::user()->id)->count()]];
     return Response::json($stats);
 }