示例#1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  StoreGameRequest $validationRequest
  * @return \Illuminate\Http\Response
  */
 public function store(StoreGameRequest $request)
 {
     $game = new Game($request->all());
     $game->save();
     Session::flash('message', 'Game created');
     return redirect('/game');
 }
 public function create($request)
 {
     $game = new Game();
     $game->name = $request->name;
     $game->short_name = $request->short_name;
     $game->logo = "https://placeholdit.imgix.net/~text?txtsize=47&txt=500%C3%97500&w=500&h=500";
     $game->save();
     return $game;
 }
示例#3
0
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|max:255|unique:games', 'description' => 'required', 'bgg_id' => 'required']);
     $game = new Game();
     $game->name = $request->name;
     $game->description = $request->description;
     $game->bgg_id = $request->bgg_id;
     if ($request->has('scorable')) {
         $game->scorable = 1;
     }
     $game->save();
     $bgg = new \App\Bgg();
     $url = 'http:' . $bgg->getGameImage($request->input('bgg_id'));
     $uploadr = new \App\Uploadr();
     $path = $uploadr->uploadFromUrl($url, $game->id, 'game');
     $game->photo = $path;
     $game->save();
     return redirect()->route('game');
 }
示例#4
0
 /**
  *儲存資料
  */
 public function store(Request $request)
 {
     $input = $request->all();
     $game = new Game();
     //game 是model 名稱
     $game->title = $input['title'];
     $game->content = $input['content'];
     $game->save();
     Game::create(['title' => $input['title']], ['content' => $input['content']]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $_games = [['name' => 'Halo 5', 'short_name' => 'H5', 'logo' => 'img/game_logos/halo_5.png'], ['name' => 'Halo 4', 'short_name' => 'H4', 'logo' => 'img/game_logos/halo_4.png'], ['name' => 'Halo 3', 'short_name' => 'H3', 'logo' => 'img/game_logos/halo_3.png'], ['name' => 'Halo 2', 'short_name' => 'H2', 'logo' => 'img/game_logos/halo_2.png'], ['name' => 'Halo CE', 'short_name' => 'HCE', 'logo' => 'img/game_logos/halo_ce.png'], ['name' => 'Halo 3: ODST', 'short_name' => 'H3:ODST', 'logo' => 'img/game_logos/halo_odst.png'], ['name' => 'Halo Reach', 'short_name' => 'HR', 'logo' => 'img/game_logos/halo_reach.png']];
     foreach ($_games as $game) {
         $g = new Game();
         $g->name = $game['name'];
         $g->short_name = $game['short_name'];
         $g->logo = $game['logo'];
         $g->save();
     }
 }
示例#6
0
 public function postCreate(Request $request)
 {
     $this->validate($request, ['title' => 'required|max:100']);
     $item = new Game();
     $item->title = $request->title;
     $item->description = $request->description;
     $item->duration = $request->duration;
     $item->participants = $request->participants;
     $item->type = $request->type;
     $item->save();
     return redirect('/category/games');
 }
 public function createGame($name)
 {
     $game = new Game();
     $game->name = $name;
     $distributionService = new DistributionService();
     $words = $distributionService->getRandom25Words();
     $dist = new Distribution();
     $dist->words = json_encode($words);
     $dist->save();
     $game->distribution_id = $dist->id;
     $game->save();
     return $dist->words;
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $game = new Game();
     $game->score = $request->score;
     $series = Series::find($request->series);
     if (!$series) {
         $series = new Series();
         $series->save();
     }
     $game->series_id = $series->id;
     $game->save();
     return Redirect::route('games.index')->with('message', 'Game added');
 }
示例#9
0
 public function start()
 {
     $game = null;
     $game_token = session('game_token');
     if ($game_token) {
         $game = Game::where('token', $game_token)->whereNull('finish_at')->latest()->first();
     }
     if (!$game) {
         $game = new Game();
         $game->token = str_random(10);
         $game->save();
         session(['game_token' => $game->token]);
     }
     return response()->json(['game_token' => $game->token, 'numbers' => $game->numbers]);
 }
 public function store()
 {
     $validator = Validator::make(Input::all(), $this->rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     } else {
         // store
         $game = new Game();
         $game->name = Input::get('name');
         $game->description = Input::get('description');
         $game->download_url = Input::get('download_url');
         $game->save();
         // redirect
         Session::flash('message', 'Successfully ');
         return Redirect::to(route('game.show', ['id' => $game->id]));
     }
 }
示例#11
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $now = Carbon::now();
     $offset = 0;
     $limit = 100;
     $game = new Game();
     $summary = new GameSummary();
     $client = new Client(['base_uri' => 'https://api.twitch.tv/kraken/', 'headers' => ['Accept' => 'application/vnd.twitchtv.v3+json'], 'timeout' => 5.0]);
     do {
         $summaryArray = [];
         $res = $client->request('GET', 'games/top', ['query' => ['offset' => $offset, 'limit' => $limit]]);
         $body = json_decode($res->getBody(), true);
         // dd($body);
         foreach ($body['top'] as $top) {
             // attempt to find game id
             $game = $game->where('twitch_id', $top['game']['_id'])->first();
             // add game to games table if doesn't exist
             if (!$game) {
                 $game = new Game();
                 $game->twitch_id = $top['game']['_id'];
                 $game->giantbomb_id = $top['game']['giantbomb_id'];
                 $game->name = $top['game']['name'];
                 $game->box_small = $top['game']['box']['small'];
                 $game->box_medium = $top['game']['box']['medium'];
                 $game->box_large = $top['game']['box']['large'];
                 $game->logo_small = $top['game']['logo']['small'];
                 $game->logo_medium = $top['game']['logo']['medium'];
                 $game->logo_large = $top['game']['logo']['large'];
                 $game->save();
             }
             // add game summary data
             $summaryArray[] = ['game_id' => $game->id, 'channels' => $top['channels'], 'viewers' => $top['viewers'], 'created_at' => $now];
         }
         // insert game summary data
         $summary->insert($summaryArray);
         // dd($summaryArray);
         // increment offset
         $offset = $offset + $limit;
     } while (count($body['top']) > 0);
     // insert game summaries
     // $summary->insert($summaryArray);
     echo 'Done';
 }
示例#12
0
 /**
  * Add game to db
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function add()
 {
     $data = \Input::all();
     if ($data) {
         $users = explode(',', $data['users']);
         $scores = $data['score'];
         $game = new Game();
         $game->save();
         $game_id = $game->id;
         foreach ($scores as $score_id => $score) {
             foreach ($users as $user_id) {
                 $t_user_id = intval($user_id, 10);
                 $t_score = intval($score[$t_user_id], 10);
                 Score::create(['game_id' => $game_id, 'player_id' => $t_user_id, 'party_id' => $score_id, 'score' => $t_score]);
             }
         }
         return \Redirect::route('meet', $game->id);
     }
     return \Redirect::route('meets');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $series = new Series();
     $series->label = $request->label;
     $series->save();
     $game1 = new Game();
     $game1->score = $request->game1score;
     $game1->series_id = $series->id;
     $game1->series_game_number = 1;
     $game1->save();
     $game2 = new Game();
     $game2->score = $request->game2score;
     $game2->series_id = $series->id;
     $game2->series_game_number = 2;
     $game2->save();
     $game3 = new Game();
     $game3->score = $request->game3score;
     $game3->series_id = $series->id;
     $game3->series_game_number = 3;
     $game3->save();
     return Redirect::route('series.index')->with('message', 'Series added');
 }
示例#14
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $lien = $this->argument('lien');
     $id = $this->argument('id');
     if (is_array($lien)) {
         $lien = $lien[0];
     }
     $game = xml_chp_renc($lien);
     foreach ($game->joueur as $joueur) {
         $compo = Composition::where('round_id', $id)->where('xja', $joueur->xja)->where('xjb', $joueur->xjb)->first();
         if ($compo == null) {
             $compo = new Composition();
         }
         $compo->round_id = $id;
         $compo->xja = $joueur->xja;
         $compo->xca = $joueur->xca;
         $compo->xjb = $joueur->xjb;
         $compo->xcb = $joueur->xcb;
         $compo->save();
     }
     Game::where('round_id', $id)->update(['active' => 0]);
     $i = 1;
     foreach ($game->partie as $partie) {
         $game = Game::where('round_id', $id)->where('game', $i)->first();
         if ($game == null) {
             $game = new Game();
         }
         $game->round_id = $id;
         $game->game = $i;
         $game->ja = $partie->ja;
         $game->scorea = $partie->scorea;
         $game->jb = $partie->jb;
         $game->scoreb = $partie->scoreb;
         $game->active = 1;
         $game->save();
         $i++;
     }
 }
示例#15
0
 /**
  * @return bool
  *
  * Track all round record into Database.
  */
 public function track()
 {
     /**
      * @var Game
      */
     $game = new Game();
     $game->tag = $this->roundTag;
     $game->server_time = $this->serverTime;
     $game->round_time = $this->timePlayed;
     $game->round_index = $this->roundIndex + 1 . " / " . $this->roundLimit;
     $game->gametype = $this->gameType;
     $game->outcome = $this->roundOutcome;
     $game->map_id = $this->gameMap;
     $game->total_players = $this->totalPlayers;
     $game->swat_score = $this->swatScore;
     $game->suspects_score = $this->suspectsScore;
     $game->swat_vict = $this->swatVictory;
     $game->suspects_vict = $this->suspectsVictory;
     if (!$game->save()) {
         return false;
     }
     /**
      * Iterate over each player array
      */
     foreach ($this->players as $p) {
         /**
          * @var Player
          */
         $player = new Player();
         $player->ingame_id = $p[0];
         $player->ip_address = $p[1];
         $player->name = str_replace('(VIEW)', '', $p[5]);
         $player->name = str_replace('(SPEC)', '', $player->name);
         $player->team = array_key_exists(6, $p) ? $p[6] : 0;
         $player->is_admin = array_key_exists(3, $p) ? $p[3] : 0;
         $player->is_dropped = array_key_exists(2, $p) ? $p[2] : 0;
         $player->score = array_key_exists(8, $p) ? $p[8] : 0;
         $player->time_played = array_key_exists(7, $p) ? $p[7] : 0;
         $player->kills = array_key_exists(9, $p) ? $p[9] : 0;
         $player->team_kills = array_key_exists(10, $p) ? $p[10] : 0;
         $player->deaths = array_key_exists(11, $p) ? $p[11] : 0;
         $player->suicides = array_key_exists(12, $p) ? $p[12] : 0;
         $player->arrests = array_key_exists(13, $p) ? $p[13] : 0;
         $player->arrested = array_key_exists(14, $p) ? $p[14] : 0;
         $player->kill_streak = array_key_exists(15, $p) ? $p[15] : 0;
         $player->arrest_streak = array_key_exists(16, $p) ? $p[16] : 0;
         $player->death_streak = array_key_exists(17, $p) ? $p[17] : 0;
         $player->game_id = $game->id;
         $player_ip_trim = substr($p[1], 0, strrpos($p[1], "."));
         $player_country_id = 0;
         $geoip = App::make('geoip');
         try {
             if ($player_geoip = $geoip->city($player->ip_address)) {
                 $player_isoCode = $player_geoip->country->isoCode;
                 $country = Country::where('countryCode', 'LIKE', $player_isoCode)->first();
                 /**
                  * Country returned is not in Countrie table
                  */
                 if ($country == null) {
                     $player_country_id = 0;
                 } else {
                     $player_country_id = $country->id;
                 }
             }
         } catch (\Exception $e) {
             switch ($e) {
                 case $e instanceof \InvalidArgumentException:
                     $player_country_id = 0;
                     break;
                 case $e instanceof \GeoIp2\Exception\AddressNotFoundException:
                     $player_country_id = 0;
                     break;
                 default:
                     $player_country_id = 0;
                     break;
             }
         }
         $loadout_array = array_key_exists(39, $p) ? $p[39] : [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
         /**
          * @var Loadout
          *
          * Create or find and return instance of Loadout and save to database.
          */
         $loadout = Loadout::firstOrCreate(['primary_weapon' => array_key_exists(0, $loadout_array) ? $loadout_array[0] : 0, 'primary_ammo' => array_key_exists(1, $loadout_array) ? $loadout_array[1] : 0, 'secondary_weapon' => array_key_exists(2, $loadout_array) ? $loadout_array[2] : 0, 'secondary_ammo' => array_key_exists(3, $loadout_array) ? $loadout_array[3] : 0, 'equip_one' => array_key_exists(4, $loadout_array) ? $loadout_array[4] : 0, 'equip_two' => array_key_exists(5, $loadout_array) ? $loadout_array[5] : 0, 'equip_three' => array_key_exists(6, $loadout_array) ? $loadout_array[6] : 0, 'equip_four' => array_key_exists(7, $loadout_array) ? $loadout_array[7] : 0, 'equip_five' => array_key_exists(8, $loadout_array) ? $loadout_array[8] : 0, 'breacher' => array_key_exists(9, $loadout_array) ? $loadout_array[9] : 0, 'body' => array_key_exists(10, $loadout_array) ? $loadout_array[10] : 0, 'head' => array_key_exists(11, $loadout_array) ? $loadout_array[11] : 0]);
         /**
          * Create or find and return instance of Alias.
          */
         $alias = Alias::firstOrNew(['name' => $player->name]);
         /**
          * If Alias is not present then new instance is created.
          */
         if ($alias->id == null) {
             //$profile = Profile::firstOrNew(['ip_address' => $player_ip_trim.'%']);
             $profile = Profile::where('ip_address', 'LIKE', $player_ip_trim . '%')->first();
             // If no profile present create new else ignore.
             if (!$profile) {
                 $profile = new Profile();
             }
             /**
              * Neither Alias not Profile is present.
              *
              * So it will create both new Alias and Profile.
              */
             if ($profile->id == null) {
                 $profile->name = $player->name;
                 $profile->team = $player->team;
                 $profile->country_id = $player_country_id;
                 $profile->loadout_id = $loadout->id;
                 $profile->game_first = $game->id;
                 $profile->game_last = $game->id;
                 $profile->ip_address = $player->ip_address;
                 $profile->save();
                 $alias->name = $player->name;
                 $alias->profile_id = $profile->id;
                 $alias->ip_address = $player->ip_address;
                 $alias->save();
             } else {
                 $alias->name = $player->name;
                 $alias->profile_id = $profile->id;
                 $alias->ip_address = $player->ip_address;
                 $alias->save();
                 $profile->team = $player->team;
                 $profile->game_last = $game->id;
                 $profile->loadout_id = $loadout->id;
                 $profile->ip_address = $player->ip_address;
                 $profile->country_id = $player_country_id;
                 $profile->save();
             }
         } else {
             $profile = Profile::find($alias->profile_id);
             $profile->team = $player->team;
             $profile->game_last = $game->id;
             $profile->loadout_id = $loadout->id;
             $profile->ip_address = $player->ip_address;
             $profile->country_id = $player_country_id;
             $profile->save();
             $alias->ip_address = $player->ip_address;
             $alias->save();
         }
         $player->alias_id = $alias->id;
         $player->loadout_id = $loadout->id;
         $player->country_id = $player_country_id;
         $player->save();
         /**
          * Iterate over all Weapon of each Player if exists
          */
         if (array_key_exists(40, $p)) {
             foreach ($p[40] as $w) {
                 $weapon = new Weapon();
                 $weapon->name = $w[0];
                 $weapon->player_id = $player->id;
                 $weapon->seconds_used = array_key_exists(1, $w) ? $w[1] : 0;
                 $weapon->shots_fired = array_key_exists(2, $w) ? $w[2] : 0;
                 $weapon->shots_hit = array_key_exists(3, $w) ? $w[3] : 0;
                 $weapon->shots_teamhit = array_key_exists(4, $w) ? $w[4] : 0;
                 $weapon->kills = array_key_exists(5, $w) ? $w[5] : 0;
                 $weapon->teamkills = array_key_exists(6, $w) ? $w[6] : 0;
                 $weapon->distance = array_key_exists(7, $w) ? $w[7] : 0;
                 $weapon->save();
             }
         }
     }
     //$pt = new App\Server\Repositories\PlayerTotalRepository();
     //$pt->calculate();
     //$response = Response::make("0\\nStats has been successfully tracked",200);
     printf("%s", "0\nRound report tracked.");
     exit(0);
 }
 /**
  * Create a new match
  *
  * @param  int  $id
  * @return Response
  */
 public function storeMatch(Request $request)
 {
     $league_id = Input::get('league_id');
     $match_date = Input::get('match_date');
     $player1_id = Input::get('player1_id');
     $player2_id = Input::get('player2_id');
     $p1_score = Input::get('p1_score');
     $p2_score = Input::get('p2_score');
     $match_date = new \DateTime($match_date);
     $match_date = $match_date->format("Y-m-d h:m:s");
     if (!is_null($player1_id) && !is_null($player2_id)) {
         //create a new match
         $match = new Match();
         $match->player1_id = $player1_id;
         $match->player2_id = $player2_id;
         $match->match_date = $match_date;
         if ($p1_score > $p2_score) {
             $match->winner_id = $player1_id;
         } else {
             $match->winner_id = $player2_id;
         }
         $match->save();
         //Add match to the current league
         $league_match = new LeagueMatch();
         $league_match->league_id = $league_id;
         $league_match->match_id = $match->match_id;
         $league_match->save();
         //Create a game and add to the Match
         if (!is_null($p1_score) && !is_null($p2_score)) {
             $game = new Game();
             $game->score1 = $p1_score;
             $game->score2 = $p2_score;
             $game->save();
             $match_game = new MatchGame();
             $match_game->match_id = $match->match_id;
             $match_game->game_id = $game->id;
             $match_game->game_num = 1;
             //will be based on league format
             $match_game->save();
         }
     }
     //Redirect to add more matches; add Save Message
     return \Redirect::route('tools.league.match.create', array($league_id))->with('success', 'Match created Successfully');
 }
 /**
  * Handles an attack
  *
  * @param Game $game
  *
  * @return RedirectResponse
  */
 private function actionAttack(Game $game)
 {
     // Get game's players
     $players = $game->players;
     // Assign an attacker and a defender from the game's players
     foreach ($players as $player) {
         if ((int) $player->user_id === Auth::id()) {
             $attacker = $player;
         } else {
             $defender = $player;
         }
     }
     // Decide randomly who wins and who loses
     $loser = rand(0, 1) === 0 ? $defender : $attacker;
     // Reduce by one the troops of the losing player
     $loser->troops = $loser->troops - 1;
     $loser->save();
     // If losing player now has 0 troops, Game ends:
     if ($loser->troops === 0) {
         $game->state = Game::STATE_CLOSED;
         $game->user_winner = $attacker->user_id;
         // @todo Game->winner_id = $winner->id;
         $game->save();
     }
     session()->flash('success', sprintf(self::MESSAGE_ACTION_ATTACK));
     return redirect()->route(self::ROUTE_SHOW_GAME, $game->id);
 }
示例#18
0
 /**
  * Store a newly created resource in storage.
  *
  * @return \Illuminate\Http\Response
  *
  * @param \App\Http\Requests\GameCreateRequest $request
  *
  * GameCreateRequest -> Validator
  *
  * Usage of GiantBombApi to get the name
  */
 public function store(GameCreateRequest $request, Game $game)
 {
     $games = new GiantBombApi();
     $game->id = $request->input('id');
     $game->game_name = $games->getGameNameFromApi($request->input('id'))['name'];
     //        if($request->hasFile('game_background_video')){
     //            $game->game_background_video  = $request->file('game_background_video')->getClientOriginalName();
     ////            dd($request->file('game_background_video')->getFilename());
     //            $fileNew = $request->file('game_background_video')->getFilename();
     //            $fileOld = $request->file('game_background_video')->getClientOriginalName();
     //            Storage::disk('local')->put($fileOld, $fileNew);
     //
     //        }
     $game->game_background_video = $request->input('game_background_video');
     //        dd($game->game_background_video);
     $game->game_background_img = $request->input('game_background_img');
     $game->custom_payment_link = $request->input('custom_payment_link');
     $game->steam_payment_link = $request->input('steam_payment_link');
     $game->ios_payment_link = $request->input('ios_payment_link');
     $game->psn_payment_link = $request->input('psn_payment_link');
     $game->android_payment_link = $request->input('android_payment_link');
     $game->save();
     return redirect('/admin/games')->with('message', 'Successfully created a new game');
 }
示例#19
0
 public function store(Request $request)
 {
     $game = new Game(array('pgn' => $request->get('pgn'), 'fritz' => $request->get('fritz')));
     $game->save();
     $data = array('pgn' => $request->get('pgn'), 'fritz' => $request->get('fritz'));
     Mail::send('emails.import', $data, function ($message) {
         $message->from(env('EMAIL_ADDRESS'), 'Chess Games');
         $message->to('*****@*****.**')->subject('PGN Imported');
     });
     Toastr::success('Game created.');
     return redirect('/games');
 }
示例#20
0
 /**
  * init une nouvelle partie
  */
 public function replay(Request $request)
 {
     if ($request->ajax()) {
         $quizz = Quizz::where('status', 1)->first();
         $idQuizz = $quizz->id;
         if (\Auth::check()) {
             $fbMe = \Auth::user();
             $array = array();
             $array = serialize($array);
             $gameMe = new Game();
             $gameMe->date_begin = new \DateTime('now');
             $gameMe->id_facebook = $fbMe['id_facebook'];
             $gameMe->id_quizz = $idQuizz;
             $gameMe->score = 0;
             $gameMe->response = $array;
             $gameMe->date_end = new \DateTime('now');
             $gameMe->save();
             Session::put('start', null);
             Session::put('pause', null);
         }
     }
     return 'ok';
 }
示例#21
0
 public function addNewGame(Request $request)
 {
     if (Auth::guest()) {
         flash()->error("You need to be logged in to add a game");
         return redirect()->back();
     }
     $game = new Game();
     $game->popularity = 0;
     // !
     // Check if console exists
     $console = Console::where('name', $request->console)->first();
     if (!$console) {
         flash("Something went wrong.");
         return redirect()->back();
     }
     // Check if game is already in the database
     $alreadyThereGame = Game::where('title', $request->input('title'))->where('console_id', $console->id)->first();
     if ($alreadyThereGame) {
         // Redirect users to the game page that's already theree
         return redirect()->route('game', ['slug' => $alreadyThereGame->slug]);
     }
     $game->console_id = (int) $console->id;
     // !
     $game->title = $request->input('title');
     // !
     $slug = $request->input('title');
     $slug = str_limit($slug, 40) . "-" . $console->short_name;
     $slug = str_slug($slug);
     $slug = strtolower($slug);
     $game->slug = $slug;
     // !
     // Stores the boxart in S3 servers
     if ($request->input('boxart_url')) {
         $boxart = Image::make($request->input('boxart_url'))->resize(350, null, function ($constraint) {
             $constraint->aspectRatio();
         })->encode(pathinfo($request->input('boxart_url'), PATHINFO_EXTENSION));
         $filename = $slug . "-" . str_random(5) . "." . pathinfo($request->input('boxart_url'), PATHINFO_EXTENSION);
         Storage::put($filename, (string) $boxart);
         $game->boxart = $filename;
         // !
     }
     $game->save();
     return redirect()->route('game', ['slug' => $slug]);
 }
示例#22
0
 /**
  * Create a room, given the name of the room. Only unique
  * @param Request
  * @return \Illuminate\Http\Response
  */
 public function create_room(Request $request)
 {
     // Make sure that the name only has letters and is unique
     $validator = Validator::make($request->all(), ['name' => 'required|alpha|max:60|unique:games']);
     if ($validator->fails()) {
         return $validator->errors()->all();
     } else {
         // If the name is ok, then create the game
         $game = new Game();
         $game->name = $request->input('name');
         $game->player1 = null;
         $game->player2 = null;
         $game->nextturn = 1;
         $game->save();
         return response()->json(['success' => 'created_room'], 401);
     }
 }