private static function get_image_from_steam($auth)
 {
     //If not calculate the steamid64
     $steam64 = SteamConvertController::steamid_to_community(SteamConvertController::auth_to_steamid($auth));
     //Get the image from steam
     $url = "http://steamcommunity.com/profiles/" . $steam64 . "?xml=1";
     $xml = simplexml_load_string(file_get_contents($url));
     $avatar_url = $xml->avatarMedium;
     //Store it in the cache
     return file_get_contents($avatar_url);
 }
 /**
  * Login the user via steam
  *
  * @param Request $request
  * @return Response
  */
 public function steamlogin(Request $request)
 {
     //Handle the return and try to validate it
     try {
         $community = SteamLogin::validate();
     } catch (\Exception $e) {
         //If not possible show 401 error
         Log::notice("Invalid Steam Auth Attempt");
         view()->share('message', $e->getMessage());
         abort(401);
     }
     //Get the auth string for the steamid64
     $steam = SteamConvertController::communityid_to_steam($community);
     $auth = SteamConvertController::steamid_to_auth($steam);
     Log::debug("Successful Stem Auth", ["CommunityID" => $community, "SteamID" => $steam, "auth" => $auth]);
     //Get the userid for the auth string
     try {
         $user = StoreUser::where("auth", $auth)->firstOrFail();
     } catch (\Exception $e) {
         Log::notice("User does not exist in db", ["auth" => $auth]);
         view()->share('message', 'You have to play on the server before you can use the UserPanel');
         abort(401);
     }
     //Set the session vars
     $request->session()->put('store_user_authmethod', 'steam_openid');
     $request->session()->put('store_user_id', $user->id);
     $request->session()->put('store_user_name', $user->name);
     $request->session()->put('store_user_auth', $user->auth);
     //Redirect the user to the User Dashboard
     return redirect()->route('userpanel.dashboard');
 }