/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $dt = new DateTime();
     $req = $request->all();
     $User = [];
     $Game = [];
     $User = User::where('facebook_id', $req["facebook_id"])->get();
     $position_longitude = "-70.584075208";
     $position_latitude = "-33.415208";
     $full_name = $req["full_name"];
     if ($User->count() > 0) {
         $UserNew = $User[0]->user_id;
         $full_name = $User[0]->full_name;
         $new = false;
     } else {
         $UserNew = DB::table('users')->insertGetId(['full_name' => $req["full_name"], 'name' => $req["last_name"], 'facebook_id' => $req["facebook_id"], 'facebook_token' => $req["facebook_token"], 'position_longitude' => $position_longitude, 'position_latitude' => $position_latitude]);
         $new = true;
     }
     $Game = Game::where('user_id', $UserNew)->where('finish', '0000-00-00 00:00:00')->get();
     if ($Game->count() > 0) {
         $GameNew = $Game[0]->game_id;
     } else {
         $GameNew = DB::table('game')->insertGetId(['user_id' => $UserNew, 'start' => $dt->format('y-d-m H:i:s')]);
     }
     return response()->json(array('full_name' => $full_name, 'user_id' => $UserNew, 'game_id' => $GameNew, 'new' => $new));
 }
Beispiel #2
0
 public static function guess($id, $char)
 {
     $game = Game::where('status', self::BUSY)->findOrFail($id);
     $chars = $game->characters_guessed;
     if (in_array(strtolower($char), $chars)) {
         throw (new CharacterUsedException($char . ' has already been used'))->setGame($game);
     }
     if (strpos($game->word, $char) === false) {
         $game->tries_left--;
     }
     $chars[] = $char;
     $game->characters_guessed = $chars;
     if ($game->won()) {
         $game->status = self::SUCCESS;
         $game->save();
         throw (new GameWonException('Congratulations! ' . $game->word . ' is the correct word.'))->setGame($game);
     }
     if ($game->tries_left <= 0) {
         $game->status = self::FAIL;
         $game->save();
         throw (new GameOverException('You lost. The word was: ' . $game->word))->setGame($game);
     }
     $game->save();
     return $game;
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $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);
         foreach ($body['top'] as $top) {
             // attempt to find game id
             $game = $this->game->where('twitch_id', $top['game']['_id'])->first();
             // add game to games table if doesn't exist
             if (!$game) {
                 $game = new $this->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
         $this->game_summary->insert($summaryArray);
         // dd($summaryArray);
         // increment offset
         $offset = $offset + $limit;
     } while (count($body['top']) > 0);
     // insert game summaries
     // $summary->insert($summaryArray);
     // echo 'Done';
 }
Beispiel #4
0
 public function reset()
 {
     $game = null;
     $game_token = session('game_token');
     if ($game_token) {
         $game = Game::where('token', $game_token)->latest()->first();
         $game->finish_at = $game->freshTimestamp();
         $game->save();
         session('game_token', false);
     }
     return response()->json(['status' => true]);
 }
 public function joinGame()
 {
     $gameID = Input::all();
     if ($gameID['id'] == -1) {
         $game = Game::where('token', 'NOT LIKE', "")->where('token', '=', $gameID['token'])->first();
         $error = $this->insertInGame($game);
     } else {
         $game = Game::find($gameID['id']);
         $error = $this->insertInGame($game);
     }
     return response()->json(['game' => $game, 'error' => $error]);
 }
Beispiel #6
0
 public function listGames()
 {
     if (Auth::user()) {
         $nickname = Auth::user()->nickname;
         //$title = "Utilizadores";
         // $users = User::paginate(10);
         $gamesWaiting = Game::where('status', 'LIKE', 'Waiting')->orderBy('gameName', 'DESC')->get();
         $gamesPlaying = Game::where('status', 'LIKE', 'Playing')->orderBy('gameName', 'DESC')->get();
         $gamesStarting = Game::where('status', 'LIKE', 'Starting')->where('gameOwner', 'LIKE', $nickname)->orderBy('gameName', 'DESC')->get();
         //  return view('guest_all.users-list', compact('users', 'title', 'featured'));
         //return view('gameLobby', compact('nickname', 'gamesWaiting', 'gamesPlaying'));
         return response()->json(['gamesPlaying' => $gamesPlaying, 'gamesWaiting' => $gamesWaiting, 'gamesStarting' => $gamesStarting]);
     }
 }
Beispiel #7
0
 public function createRoom(Request $request)
 {
     $createGame = Game::prepareCreateGame(Input::all());
     if (Game::where('gameName', '=', $createGame['gameName'])->first() != null) {
         return Redirect::to('gameLobby')->with('message', 'Game Already Exists!');
     }
     $user = Auth::user()->id;
     $gameCreated = Game::create($createGame);
     $gameCreated->attachPlayersToGame();
     $player = User::findOrFail($user);
     $relation = $player->games->find($gameCreated['game_id']);
     $relation->pivot->isPlayer = 1;
     if ($gameCreated->joinedPlayers == $gameCreated->maxPlayers) {
         $gameCreated->status = "Playing";
     }
     $relation->pivot->save();
     $gameCreated->save();
     return Redirect::to('gameLobby')->with('message', 'Game Created!');
 }
Beispiel #8
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++;
     }
 }
Beispiel #9
0
 /**
  * Show game by id.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $game = Game::where('id', '=', $id)->with('Scores')->first();
     if ($game === NULL) {
         $this->tpl['title'] = 'Not found';
         $this->tpl['error']['message'] = 'Game not found';
         $this->tpl['error']['description'] = 'Sorry, but this game is not found.';
         return \Response::view('errors.404', $this->tpl);
     }
     $players_get = $game->getPlayers();
     if (!$players_get) {
         $this->tpl['title'] = 'Not found';
         $this->tpl['error']['message'] = 'This game has not players';
         $this->tpl['error']['description'] = 'Sorry, but this game has not found players.';
         return \Response::view('errors.404', $this->tpl);
     }
     $players = [];
     foreach ($players_get as $player) {
         array_push($players, array('id' => $player->id, 'summary' => $game->scoreOfPlayer($player->id), 'percent' => $game->getPercentOfPlayer($player->id), 'obj' => $player));
     }
     $player_sorted = $players;
     usort($player_sorted, function ($a, $b) {
         return $a['summary'] < $b['summary'];
     });
     $scores = [];
     foreach ($game->Scores as $item) {
         if (!isset($scores[$item->party_id])) {
             $scores[$item->party_id] = [];
         }
         $scores[$item->party_id][$item->player_id] = $item->score;
     }
     $this->tpl['players'] = $players;
     $this->tpl['game'] = $game;
     $this->tpl['players_sorted'] = $player_sorted;
     $this->tpl['scores'] = $scores;
     return view('game.show', $this->tpl);
 }
 public function newDistribution($game)
 {
     $game = Game::where('name', $game)->orderBy('id', 'desc')->first();
     $distributionService = new DistributionService();
     $words = $distributionService->getRandom25Words();
     $dist = new Distribution();
     $dist->words = json_encode($words);
     $dist->save();
     $game->distribution_id = $dist->id;
     $game->save();
     return $words;
 }
 public function wantGame($slug)
 {
     if (Auth::guest()) {
         flash()->error('You need to be logged in to want a game.');
         return redirect()->back();
     }
     $game = Game::where('slug', $slug)->first();
     if (!$game) {
         flash()->error("The game you're trying to want does not exist.");
         return redirect()->back();
     }
     $want = Want::where('user_id', Auth::user()->id)->where('game_id', $game->id)->first();
     if ($want) {
         $want->delete();
         flash()->warning("You have removed " . $game->title . " from your want list.");
         return redirect()->back();
     } else {
         $want = new Want();
         $want->game_id = $game->id;
         $want->user_id = Auth::user()->id;
         $want->save();
         flash()->success("You added " . $game->title . " to your want list.");
         return redirect()->back();
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $game = \App\Game::where('id', $id)->first();
     $game->delete();
 }
Beispiel #13
0
 public function search(Request $request)
 {
     $token = $request->get('token');
     $player = $request->get('player');
     $color = $request->get('color');
     if (strlen($token) > 0) {
         $games = Game::where('pgn', 'LIKE', '%' . $token . '%')->orderBy('gameDate', 'desc')->orderBy('gameRound', 'desc')->orderBy('white')->orderBy('black')->paginate(env('RECIPE_PAGINATION_MAX'));
     } elseif (strlen($player) > 0) {
         if (strlen($color) > 0) {
             if (strtolower($color) == 'white') {
                 $games = Game::where('white', 'LIKE', '%' . $player . '%')->orderBy('gameDate', 'desc')->orderBy('gameRound', 'desc')->orderBy('white')->orderBy('black')->paginate(env('RECIPE_PAGINATION_MAX'));
             } else {
                 $games = Game::where('black', 'LIKE', '%' . $player . '%')->orderBy('gameDate', 'desc')->orderBy('gameRound', 'desc')->orderBy('white')->orderBy('black')->paginate(env('RECIPE_PAGINATION_MAX'));
             }
         } else {
             $games = Game::where('pgn', 'LIKE', '%' . $player . '%')->orderBy('gameDate', 'desc')->orderBy('gameRound', 'desc')->orderBy('white')->orderBy('black')->paginate(env('RECIPE_PAGINATION_MAX'));
         }
     }
     return view('games.index')->with('games', $games);
 }
Beispiel #14
0
 /**
  * Affiche la liste des gagnants/meilleurs joueurs
  */
 public function winners(Request $request)
 {
     $quizz = Quizz::where('status', 2)->first();
     if (is_null($quizz)) {
         return redirect(route('front.index'));
     } else {
         $idQuizz = $quizz->id;
         $winners = Game::where('id_quizz', $idQuizz)->select()->orderBy('id_facebook', 'desc')->get();
         $winners_order = array();
         foreach ($winners as $key => $value) {
             $one = Game::select()->where('id_facebook', $value['id_facebook'])->where('id_quizz', $idQuizz)->orderBy('score')->first()->toArray();
             if (array_search($value['id_facebook'], $winners_order)) {
                 echo 'déjààà';
             } else {
                 array_push($winners_order, $one);
             }
         }
         var_dump($winners_order);
         return view('front.winners', array('pageName' => 'winners', 'winners' => $winners, 'quizz' => $quizz));
     }
 }
 public function viewTodayQuiz()
 {
     $user_id = Auth::user()->id;
     $year = date('Y');
     $month = date('n');
     $day = date('j');
     $firstMonday = date("j", strtotime('first monday of ' . $year . '-' . $month));
     $leagueYear = $year;
     if ($firstMonday > $day) {
         $leagueMonth = $month - 1;
         if (!$leagueMonth) {
             $leagueMonth = 12;
             $leagueYear--;
         }
     } else {
         $leagueMonth = $month;
     }
     $dayOffset = 0;
     $round = 0;
     for ($i = 0; $i < 20; $i++) {
         $round++;
         if (date("d-m-Y") == date("d-m-Y", strtotime('first monday of ' . $leagueYear . '-' . $leagueMonth) + 86400 * $dayOffset)) {
             break;
         }
         if (($i + 1) % 5 == 0) {
             $dayOffset = $dayOffset + 3;
         } else {
             $dayOffset++;
         }
     }
     if ($round % 10 == 0) {
         $solo = true;
     } else {
         $solo = false;
     }
     $leagues = League::where('year', $year)->where('month', $leagueMonth)->get();
     $league_id = 0;
     foreach ($leagues as $key => $league) {
         $players = json_decode($league->users);
         if (in_array($user_id, $players)) {
             $league_id = $league->id;
         }
     }
     $opponent = 0;
     $roundGame = Game::where('user_1_id', $user_id)->where('round', $round)->where('league_id', $league_id)->first();
     if (!count($roundGame)) {
         $roundGame = Game::where('user_2_id', $user_id)->where('round', $round)->where('league_id', $league_id)->first();
         if (count($roundGame)) {
             $opponent = $roundGame->user_1_id;
         }
     } else {
         $opponent = $roundGame->user_2_id;
     }
     if ($opponent) {
         $start = (new Carbon('now'))->hour(0)->minute(0)->second(0);
         $end = (new Carbon('now'))->hour(23)->minute(59)->second(59);
         $answers = Answer::where('submitted', 1)->where('user_id', $opponent)->whereNotBetween('updated_at', [$start, $end])->get();
         $genresCollection = Genre::all();
         $subgenresCollection = Subgenre::all();
         $genres = array();
         foreach ($genresCollection as $key => $genre) {
             $genres[$genre->id] = array();
             $genres[$genre->id]['info'] = $genre;
             $genres[$genre->id]['corrects'] = 0;
             $genres[$genre->id]['total'] = 0;
             $genres[$genre->id]['percentage'] = 0;
         }
         $subgenres = array();
         foreach ($subgenresCollection as $key => $subgenre) {
             $subgenres[$subgenre->id] = array();
             $subgenres[$subgenre->id]['info'] = $subgenre;
             $subgenres[$subgenre->id]['corrects'] = 0;
             $subgenres[$subgenre->id]['total'] = 0;
             $subgenres[$subgenre->id]['percentage'] = 0;
         }
         foreach ($answers as $key => $answer) {
             $answerQuestion = $answer->question()[0];
             $answerGenre = $answerQuestion->genre_id;
             $answerSubgenre = $answerQuestion->subgenre_id;
             if ($answer->correct) {
                 $genres[$answerGenre]['corrects']++;
                 $subgenres[$answerSubgenre]['corrects']++;
             }
             $genres[$answerGenre]['total']++;
             $subgenres[$answerSubgenre]['total']++;
         }
         foreach ($genres as $key => $genre) {
             if ($genres[$key]['total']) {
                 $genres[$key]['percentage'] = round($genre['corrects'] / $genre['total'] * 100, 2);
             }
         }
         $percentage = array();
         foreach ($subgenres as $key => $subgenre) {
             if ($subgenres[$key]['total']) {
                 $subgenres[$key]['percentage'] = round($subgenre['corrects'] / $subgenre['total'] * 100, 2);
                 $percentage[$key] = $subgenres[$key]['percentage'];
             } else {
                 $subgenres[$key]['percentage'] = 0;
                 $percentage[$key] = 0;
             }
         }
         if ($percentage) {
             array_multisort($percentage, SORT_DESC, $subgenres);
         }
         $opponent = User::find($opponent);
     } else {
         $genres = [];
         $subgenres = [];
     }
     $questions = Question::where('year', $year)->where('month', $month)->where('day', $day)->get();
     $filetype = [];
     $answers = [];
     foreach ($questions as $key => $question) {
         $filetype[$question->genre_id] = pathinfo($question->filename, PATHINFO_EXTENSION);
         $answers[$question->genre_id] = '';
     }
     $submitted = false;
     foreach ($questions as $key => $question) {
         $answer = Answer::where('question_id', $question['id'])->where('user_id', $user_id)->orderBy('id', 'desc')->first();
         $answers[$question->genre_id] = $answer;
         if ($answer) {
             if ($answer->submitted) {
                 $submitted = true;
             }
         }
     }
     if ($submitted) {
         return view('quiz_answered')->with(['questions' => $questions, 'answers' => $answers, 'filetype' => $filetype, 'year' => $year, 'month' => $month, 'day' => $day, 'solo' => $solo]);
     } else {
         return view('quiz')->with(['questions' => $questions, 'filetype' => $filetype, 'answers' => $answers, 'solo' => $solo, 'genres' => $genres, 'subgenres' => $subgenres, 'opponent' => $opponent]);
     }
 }
Beispiel #16
0
 public function game($gameId)
 {
     if (isset($gameId) && Game::where('status', Game::STATUS_FINISHED)->where('id', $gameId)->count()) {
         $game = Game::with(['winner'])->where('status', Game::STATUS_FINISHED)->where('id', $gameId)->first();
         $game->ticket = floor($game->rand_number * ($game->price * 100));
         $bets = $game->bets()->with(['user', 'game'])->get()->sortByDesc('created_at');
         $chances = [];
         $percents = $this->_getChancesOfGame($game, true);
         return view('pages.game', compact('game', 'bets', 'chances', 'percents'));
     }
     return redirect()->route('index');
 }
Beispiel #17
0
 public function parseAction(Request $request)
 {
     switch ($request->get('action')) {
         case 'userInfo':
             $user = User::where('steamid64', $request->get('id'))->first();
             if (!is_null($user)) {
                 $games = Game::where('winner_id', $user->id)->get();
                 $wins = $games->count();
                 $gamesPlayed = \DB::table('games')->join('bets', 'games.id', '=', 'bets.game_id')->where('bets.user_id', $user->id)->groupBy('bets.game_id')->orderBy('games.created_at', 'desc')->select('games.*', \DB::raw('SUM(bets.price) as betValue'))->get();
                 $gamesList = [];
                 $i = 0;
                 foreach ($gamesPlayed as $game) {
                     $gamesList[$i] = (object) [];
                     $gamesList[$i]->id = $game->id;
                     $gamesList[$i]->win = false;
                     $gamesList[$i]->bank = $game->price;
                     if ($game->winner_id == $user->id) {
                         $gamesList[$i]->win = true;
                     }
                     if ($game->status != Game::STATUS_FINISHED) {
                         $gamesList[$i]->win = -1;
                     }
                     $gamesList[$i]->chance = round($game->betValue / $game->price, 3) * 100;
                     $i++;
                 }
                 return response()->json(['username' => $user->username, 'avatar' => $user->avatar, 'votes' => $user->votes, 'wins' => $wins, 'url' => 'http://steamcommunity.com/profiles/' . $user->steamid64 . '/', 'winrate' => count($gamesPlayed) ? round($wins / count($gamesPlayed), 3) * 100 : 0, 'totalBank' => $games->sum('price'), 'games' => count($gamesPlayed), 'list' => $gamesList]);
             }
             return response('Error. User not found.', 404);
             break;
         case 'voteUser':
             $user = User::where('steamid64', $request->get('id'))->first();
             if (!is_null($user)) {
                 if ($user->id == $this->user->id) {
                     return response()->json(['status' => 'error', 'msg' => 'Вы не можете голосовать за себя.']);
                 }
                 $votes = $this->redis->lrange($user->steamid64 . '.user.votes.list', 0, -1);
                 if (in_array($this->user->id, $votes)) {
                     return response()->json(['status' => 'error', 'msg' => 'Вы уже голосовали за этого пользователя.']);
                 } else {
                     $user->votes++;
                     $user->save();
                     $this->redis->rpush($user->steamid64 . '.user.votes.list', $this->user->id);
                     return response()->json(['status' => 'success', 'votes' => $user->votes]);
                 }
             }
             return response('Error. User not found.', 404);
             break;
         case 'shopSort':
             $options = $request->get('options');
             if (is_null($options['searchRarity']) || empty($options['searchRarity']) || $options['searchRarity'] == NULL) {
                 $options['searchRarity'] = ["Тайное", "Засекреченное", "Запрещенное", "Промышленное качество", "Армейское качество"];
             }
             if (is_null($options['searchQuality']) || empty($options['searchQuality']) || $options['searchQuality'] == NULL) {
                 $options['searchQuality'] = ["Прямо с завода", "Немного поношенное", "После полевых испытаний", "Поношенное", "Закаленное в боях"];
             }
             if (is_null($options['searchType']) || empty($options['searchType']) || $options['searchType'] == NULL) {
                 $options['searchType'] = ["Нож", "Винтовка", "Дробовик", "Пистолет", "Снайперская винтовка", "Пулемёт"];
             }
             $items = Shop::where('name', 'like', '%' . $options['searchName'] . '%')->whereBetween('price', [$options['minPrice'], $options['maxPrice'] + 1])->whereIn('type', $options['searchType'])->whereIn('rarity', $options['searchRarity'])->whereIn('quality', $options['searchQuality'])->orderBy('price', $options['sort'])->where('status', Shop::ITEM_STATUS_FOR_SALE)->get();
             return $items->toArray();
             break;
     }
 }
Beispiel #18
0
|
*/
Route::get('/', function () {
    return view('welcome');
});
Route::get('relasi-1', function () {
    $anggota = Anggota::where('nama', '=', 'Arvin Chendriyana Supriyadi')->first();
    return $anggota->detailanggota->alamat;
});
Route::get('relasi-2', function () {
    $anggota = Anggota::where('nama', '=', 'Arvin Chendriyana Supriyadi')->first();
    return $anggota->rental->nama;
});
Route::get('relasi-3', function () {
    $rental = Rental::where('nama', '=', 'Hanzo')->first();
    foreach ($rental->anggota as $temp) {
        echo '<li> Nama : ' . $temp->nama . '</li>';
    }
});
Route::get('relasi-4', function () {
    $arvin = Anggota::where('nama', '=', 'Arvin Chendriyana Supriyadi')->first();
    foreach ($arvin->game as $temp) {
        echo '<li>' . $temp->judul . '</li>';
    }
});
Route::get('relasi-5', function () {
    $fallout_4 = Game::where('judul', '=', 'Fallout 4')->first();
    foreach ($fallout_4->anggota as $temp) {
        echo '<li> Nama : ' . $temp->nama . '</li>';
    }
});
Beispiel #19
0
        }
        return view('games.search', compact('games', 'term', 'pageSearch', 'css', 'page'))->with([
            'title' => 'Search result for '.$term.' - AppForAndroidPhone',
            'desc' => '',
            'keyword' => ''
        ]);
    }
});

//categories details

Route::get('android/{value}', function($value){
    if (preg_match('/top-([a-z0-9\-]+)-(apps|games)/', $value, $matches)) {
        $css = 'app';
        $category = Category::where('slug', $matches[1])->first();
        $games = Game::where('category_id', $category->id)->paginate(20);
        $page = $category->name;
        return view('games.category', compact('category', 'games', 'page', 'css'))->with([
            'title' => 'Top Android '.$category->name.' '.$category->type.' Download - AppForAndroidPhone',
            'desc' => 'AppForAndroidPhone provide top and popular Android '.$category->name.' '.$category->type.' that will satisfy the needs of all types for you.',
            'keyword' => 'top android '.$category->name.' '.$category->type
        ]);
    }
});
//app details
Route::get('android-apps/{slug}', 'MainController@details');

//game details
Route::get('android-games/{slug}', 'MainController@details');

Beispiel #20
0
    /**
     * download game.
     * @param $slug
     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
     * @internal param $gameId
     */
    public function download($slug)
    {
        $css = 'details';
        if (!$slug) {
            return redirect('/');
        }
        $game = Game::where('slug', $slug)->first();

        $page = 'Direct Link download '.$game->title;
        $relates = Game::where('category_id', $game->category_id)->take(16)->get();

        return view('games.download', compact('game', 'page', 'relates', 'css'))->with([
            'title' => $game->title . ' for Android Direct Link download Free - AppForAndroidPhone',
            'desc' => 'Direct link download for '.$game->title.'  at AppForAndroidPhone.Com.',
            'keyword' => 'direct link, get apk, download .apk, '.$game->title
        ]);
    }
 public function byGame($game)
 {
     $game = Game::where('name', $game)->first();
     return $game->challenges;
 }
 public function remove(Request $request)
 {
     if (Auth::check()) {
         if (Auth::user()->role == 'admin') {
             $request = json_decode($request->input);
             if ($request->type == 'shop') {
                 Product::where('id', $request->id)->delete();
             }
             if ($request->type == 'game') {
                 Game::where('id', $request->id)->delete();
             }
             if ($request->type == 'user') {
                 User::where('id', $request->id)->delete();
             }
         }
     } else {
         return view('errors.unauthorized');
     }
 }