public function gametypes($reload = false) { if ($reload or !$this->gametypes_cache) { $id = mysql_real_escape_string($this->id); $this->gametypes_cache = Gametype::find_all("gametypes.game_id = '{$id}'"); } return $this->gametypes_cache; }
public function delete($id = null) { $game = self::load_game(); $id = mysql_real_escape_string($_GET['id']); $gametype = Gametype::find_by_id($id); if (!$gametype) { Error404(); } $gametype->destroy(); Site::flash("notice", "The gametype has been deleted"); Redirect("admin/games/{$game->id}"); }