本文整理汇总了PHP中Game::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Game::all方法的具体用法?PHP Game::all怎么用?PHP Game::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game
的用法示例。
在下文中一共展示了Game::all方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$CRs = new CR($this->db);
$this->f3->set('list', $CRs->all(30));
$Game = new Game($this->db);
$this->f3->set('games', $Game->all());
$Game = new Game($this->db);
$this->f3->set('gamesother', $Game->allOther());
$this->f3->set('site_title', 'CR, Tests, Reviews 100% Tartuffe | CROTYpedia');
$this->f3->set('view', 'cr/index.htm');
}
示例2: run
public function run()
{
$faker = Faker::create();
for ($i = 0; $i < 25; $i += 1) {
$event = new CalendarEvent();
$event->start_time = '2015-09-01 12:00:00';
$event->end_time = '2015-09-02 12:00:00';
$event->title = $faker->catchPhrase;
$event->description = $faker->text(100);
$event->price = '0';
$event->user_id = User::all()->random()->id;
$event->location_id = Location::all()->random()->id;
$event->game_id = Game::all()->random()->id;
$event->save();
}
}
示例3: index
public function index()
{
$page = isset($_GET['page']) && $_GET['page'] ? $_GET['page'] : 1;
$player = self::get_user_logged_in();
$games_count = Game::count_all_player_games($player->playerid);
$page_size = 10;
$pages = ceil($games_count / $page_size);
$games = Game::all(array('playerid' => $player->playerid, 'page' => $page, 'page_size' => $page_size));
if ($page > 1) {
$prev_page = (int) $page - 1;
} else {
$prev_page = null;
}
if ($pages > $page) {
$next_page = (int) $page + 1;
} else {
$next_page = null;
}
View::make('game/index.html', array('games' => $games, 'courses' => Course::all(), 'prev_page' => $prev_page, 'curr_page' => $page, 'next_page' => $next_page, 'pages' => $pages));
}
示例4: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
*
* @return Response
*/
public function edit($id)
{
$gameserver = Gameserver::findOrFail($id);
$games = [];
foreach (Game::all() as $game) {
$games[$game->id] = $game->name;
}
$users = [];
foreach (User::all() as $user) {
$users[$user->id] = $user->email;
}
$ips = [];
foreach (Ip::all() as $ip) {
$ips[$ip->id] = $ip->ip;
}
$port = $gameserver->ipport->port;
return View::make('admin.gameserver_edit', ['gameserver' => $gameserver, 'games' => $games, 'ips' => $ips, 'users' => $users, 'port' => $port, 'game_selected' => $gameserver->game->id, 'user_selected' => $gameserver->user->id, 'ip_selected' => $gameserver->ipport->ip->id]);
}
示例5: index
public function index()
{
// show a listing of games
$games = Game::all();
return View::make('index', compact('games'));
}
示例6: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
return View::make('admin.game_list', ['games' => Game::all()]);
}
示例7: function
<?php
View::composer(array('allround.master', 'event.add_event', 'event.edit_event', 'show.add_show', 'show.edit_show', 'user.edit_user'), function ($view) {
$games = Cache::rememberForever('games', function () {
return Game::all();
});
$view->with('games', $games);
});
View::composer(array('allround.hello', 'allround.hello_tz', 'event.index_game', 'event.index_game_tz', 'show.index_show', 'show.index_show_tz', 'user.dashboard'), function ($view) {
if (Sentry::check()) {
$user = User::find(Sentry::getUser()->id);
$user_favs = $user->userEvent()->get();
$user_favs_shows = $user->userShow()->get();
$view->with(array('user' => $user, 'user_favs' => $user_favs, 'user_favs_shows' => $user_favs_shows));
}
});
示例8: index
public static function index()
{
$page = isset($_GET['page']) && $_GET['page'] ? $_GET['page'] : 1;
$page_size = 10;
$games = array();
$playerid = null;
$courseid = null;
$url = $_SERVER['REQUEST_URI'];
$stripped_url = preg_replace("/[^A-Za-z0-9 ]/", '', $url);
// Fetch page from cache
$cached_page = Cache::getPage($stripped_url);
if ($cached_page != null && Cache::on()) {
// Use cached page (which is up to date because outdated pages are deleted)
echo $cached_page;
} else {
if (Game::count_all() > 0) {
// Make page from scratch
$game_years = Game::game_years();
if (isset($_GET['year'])) {
$year = $_GET['year'];
} else {
$year = $game_years[count($game_years) - 1];
}
// GET-parameters determine what games are shown:
if (isset($_GET['player']) && isset($_GET['course'])) {
// Show this player's games on this course
$playerid = $_GET['player'];
$courseid = $_GET['course'];
$games_count = Game::count_all_player_games_on_course($playerid, $courseid, $year);
$games = Game::all(array('page' => $page, 'page_size' => $page_size, 'playerid' => $playerid, 'courseid' => $courseid, 'year' => $year));
} else {
if (isset($_GET['player'])) {
// Show this player's games
$playerid = $_GET['player'];
$games_count = Game::count_all_player_games_by_year($playerid, $year);
$games = Game::all(array('page' => $page, 'page_size' => $page_size, 'playerid' => $playerid, 'year' => $year));
} else {
if (isset($_GET['course'])) {
// Show games on this course
$courseid = $_GET['course'];
$games_count = Game::count_all_course_games_by_year($courseid, $year);
$games = Game::all(array('page' => $page, 'page_size' => $page_size, 'courseid' => $courseid, 'year' => $year));
} else {
// Show all games
$games_count = Game::count_all_by_year($year);
$games = Game::all(array('page' => $page, 'page_size' => $page_size, 'year' => $year));
}
}
}
$pages = ceil($games_count / $page_size);
if ($page > 1) {
$prev_page = (int) $page - 1;
} else {
$prev_page = null;
}
if ($pages > $page) {
$next_page = (int) $page + 1;
} else {
$next_page = null;
}
$page_html = View::make('game/index.html', array('games' => $games, 'prev_page' => $prev_page, 'curr_page' => $page, 'next_page' => $next_page, 'pages' => $pages, 'courses' => Course::all(), 'courses_order_by_id' => Course::all_order_by_id(), 'players' => Player::all(), 'playerid_param' => $playerid, 'courseid_param' => $courseid, 'game_years' => $game_years, 'current_year' => $year));
if (Cache::on()) {
// Don't include the page message in the cached file
$page_html = Cache::strip_tags_content($page_html, "message-success");
Cache::store($stripped_url, $page_html);
}
} else {
// No games in the database
View::make('game/index.html', array('courses' => Course::all(), 'players' => Player::all()));
}
}
}