/** * @param bool|true $ispublic * @return Team[] */ function getTeams($ispublic = true) { if (!$ispublic) { $teamIds = Model::pluck(SeasonTeam::find('seasonid = ?', [$this->seasonid]), 'teamid'); } else { $teamIds = Model::pluck(SeasonTeam::find('seasonid = ? and ispublic', [$this->seasonid]), 'teamid'); } if (!$teamIds) { return []; } return Model::orderBy(Team::getMultiple($teamIds), 'name'); }
public function orderByAndPaginate($field, $order, $per_page) { return $this->model->orderBy($field, $order)->paginate($per_page); }
private function showTeamSeasons() { $teamSeasonIds = Model::pluck(SeasonTeam::find('teamid = ?', [$this->team->teamid]), 'seasonid'); $teamSeasons = Season::getMultiple($teamSeasonIds); Model::orderBy($teamSeasons, 'seasonid'); $teamMatches = Match::find('team1id = ? or team2id = ?', [$this->team->teamid, $this->team->teamid]); // $games = []; $playedGames = []; $wins = []; $losses = []; foreach($teamMatches as $match) { if (!$match->isPublished()) continue; // $games[$match->seasonid]++; if ($match->getWinner() == $this->team->teamid) { $playedGames[$match->seasonid]++; $wins[$match->seasonid]++; } if ($match->getLooser() == $this->team->teamid) { $playedGames[$match->seasonid]++; $losses[$match->seasonid]++; } } ?> <h2>Actividad por temporadas</h2> <table style="width: 400px"> <thead><tr> <td>Nombre</td> <td>Combates</td> <td>Victorias</td> <td>Derrotas</td> </tr></thead> <? foreach($teamSeasons as $season) { if (!$season->ispublic && !Team::isSuperAdmin()) continue; ?> <tr> <td> <a href="/<?=$season->getLink()?>/equipos/<?=$this->team->getLink()?>/"> <?= htmlentities($season->name) ?> </a> </td> <td><?= $playedGames[$season->seasonid] * 1 ?></td> <td><?= $wins[$season->seasonid] * 1 ?></td> <td><?= $losses[$season->seasonid] * 1 ?></td> </tr> <? } ?></table><br><? }
public function findAll() { return $this->model->orderBy('theme', 'asc')->orderBy('name', 'asc')->get(); }
public function assetModels() { if (Session::has('username') && (Session::get('user_type') == "Root" || Session::get('user_type') == "Admin")) { $view = View::make("Settings.Assets.settings_asset_models"); $assetModels = Model::orderBy("name", "asc")->paginate(25); $getAssetTypes = AssetClassification::orderBy("name")->get(); $assetTypes = array("" => "All"); foreach ($getAssetTypes as $assetType) { $assetTypes[$assetType->id] = $assetType->name; } $view->assetModels = $assetModels; $view->assetTypes = $assetTypes; $view->nav = "system"; $view->tab = "models"; return $view; } else { return Redirect::to("/"); } }
/** * @param int $perPage * @return mixed */ public function findAllPaginated($perPage = 20) { return $this->model->orderBy('id')->paginate($perPage); }