/** * Show the application dashboard to the user. * * @return Response */ public function index() { $games = Game::all()->take(20); $NewGames = Game::all()->reverse()->take(5); $FeatGames = Game::all()->take(5); return view('home', compact('games', 'NewGames', 'FeatGames')); }
/** * Run the migrations. * * @return void */ public function up() { Schema::create('packages', function(Blueprint $table) { $table->increments('id'); $table->integer('game_id')->unsigned(); $table->string('name')->unique(); $table->string('status')->nullable(); $table->timestamps(); $table->foreign('game_id') ->references('id') ->on('games') ->onDelete('cascade'); }); $games = Game::all(); foreach ($games as $i=>$game) { $temp = str_replace('http://www.9apps.com/jump/down/', '', $game->download); $temp = str_replace('/app/', '', $temp); $check = Package::where('name', $temp)->first(); if (!$check) { Package::create([ 'game_id' => $game->id, 'name' => $temp ]); } } }
public function edit($accountId) { //TODO Maybe crash $games = Game::all(); $users = User::all(); $account = Account::findOrFail($accountId); return view('admin.account.edit', ['account' => $account, 'users' => $users, 'games' => $games]); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $games = Game::all(); if (Input::get('date') == 'date') { $games = $games->reverse(); } $tags = Tag::all(); return view('games.index', compact('games', 'tags')); }
public function overview_games() { $games = \App\Game::all(); $gamesFromApi = new GiantBombApi(); $gamesArray = $gamesFromApi->getAllGames(); $tweetV = \App\Tweet::getStatusVlambeer(); $tweetR = \App\Tweet::getStatusRami(); $tweetJ = \App\Tweet::getStatusJan(); return view('pages.overview_games', compact('games', 'tweetV', 'tweetR', 'tweetJ', 'gamesArray')); }
/** * Display a listing of the resource. * * @return Response */ public function index(Request $request1) { $games = Game::all(); if ($request1->ajax()) { $user = User::findOrFail(Auth::id()); $array = array(); $array = array_add($array, 0, $games); $array = array_add($array, 1, $user); return $array; } return view('app.lobby'); }
/** * Run the migrations. * * @return void */ public function up() { Schema::table('games', function(Blueprint $table) { $table->string('slug', 32); }); $games = Game::all(); foreach( $games as $item ) { $item->slug = Str::limit( Str::slug( $item->title), 32, ''); $item->save(); } }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { if (Auth::check()) { if (Auth::user()->role == 'admin') { $games = new GiantBombApi(); $gamesArray = $games->getAllGameIds(); $dbGames = \App\Game::all(); $pluckIdFromApi = array_pluck($gamesArray, 'id'); $pluckIdFromDb = array_pluck($dbGames, 'id'); $results = array_diff($pluckIdFromApi, $pluckIdFromDb); $gameNames = []; foreach ($results as $result) { array_push($gameNames, $games->getGameNameFromApi($result)); } return view('game.create', compact('gameNames')); } } else { return view('errors.unauthorized'); } }
public function edit($serverId) { $server = Server::with('game')->findOrFail($serverId); $games = Game::all(); return view('admin.server.edit', ['server' => $server, 'games' => $games, 'page_title' => 'Edit server']); }
/** * Show the form for editing the league. * * @param int $id id of the league which should be edited * @return Response view with editing form */ public function edit($id) { $games = Game::all(); $league = League::findOrFail($id); return view('/leagues/league-create', ['games' => $games, 'edited' => $league]); }
public function create() { $category = Category::all(); $games = Game::all(); return view('games.create', ['categories' => $category, 'games' => $games]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $games = Game::all(); return view('games.index', compact('games')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $count = Game::all()->count(); $rand = rand(0, $count); return Redirect::to(url('/games', $rand)); }
public function fix() { DB::table('packages')->truncate(); $games = Game::all(); foreach ($games as $game) { if ($game->site == 'http://www.9apps.com') { $temp = str_replace('http://www.9apps.com/jump/down/', '', $game->download); $temp = str_replace('/app/', '', $temp); $temp = trim($temp); } else { $temp = str_replace('https://play.google.com/store/apps/details?id=', '', $game->link); $temp = str_replace('&hl=en&gl=us', '', $temp); $temp = trim($temp); } $count = Package::where('name', $temp)->count(); if ($count == 0) { Package::create([ 'game_id' => $game->id, 'name' => $temp ]); } } }