当前位置: 首页>>代码示例>>PHP>>正文


PHP Player::find方法代码示例

本文整理汇总了PHP中Player::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::find方法的具体用法?PHP Player::find怎么用?PHP Player::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     $participants = DB::table('event_participant')->get();
     foreach ($participants as $participant) {
         $player = Player::find($participant->player_id);
         $user = User::find($participant->user_id);
         $event = Evento::find($participant->event_id);
         $payment = Payment::find($participant->payment_id);
         $uuid = Uuid::generate();
         $new = new Participant();
         $new->id = $uuid;
         $new->firstname = $player->firstname;
         $new->lastname = $player->lastname;
         $new->due = $event->getOriginal('fee');
         $new->early_due = $event->getOriginal('early_fee');
         $new->early_due_deadline = $event->early_deadline;
         $new->method = 'full';
         $new->plan_id = Null;
         $new->player_id = $player->id;
         $new->event_id = $participant->event_id;
         $new->accepted_on = $participant->created_at;
         $new->accepted_by = $user->profile->firstname . " " . $user->profile->lastname;
         $new->accepted_user = $participant->user_id;
         $new->status = 1;
         $new->created_at = $participant->created_at;
         $new->updated_at = $participant->updated_at;
         $new->save();
         $update = Item::where('payment_id', '=', $payment->id)->firstOrFail();
         $update->participant_id = $uuid;
         $update->save();
     }
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:32,代码来源:FollowersTableSeeder.php

示例2: add

 /**
  * @param string $backUrl
  * @param int $player_id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function add($backUrl = 'entree', $player_id = 0)
 {
     if ($player_id == 0) {
         return Redirect::route($backUrl);
     }
     $player = Player::find($player_id);
     // Cree Entree
     $entree = new Entree();
     $entree->compet_id = MySession::getModel('compet')->id;
     $entree->statusentree_id = 1;
     $entree->teamname = "";
     $entree->hcp = 0;
     $entree->save();
     // Cree les EntreePlayers (en fonction du Compet->TypeCompet->nbplayers
     $nbPlayers = MySession::getModel('compet')->typecompet->nbplayers;
     for ($pl = 1; $pl <= $nbPlayers; $pl++) {
         $entreePlayer = new Entreeplayer();
         $entreePlayer->entree_id = $entree->id;
         if ($pl == 1) {
             $entreePlayer->player_id = $player->id;
             $entreePlayer->hcp = $player->hcp;
         }
         $entreePlayer->num = $pl;
         $entreePlayer->save();
         // get Categorie
         if ($pl == 1) {
             $entreePlayer->competcategorie_id = $entreePlayer->getCategorie();
             $entreePlayer->save();
         }
     }
     return Redirect::route($backUrl);
 }
开发者ID:birdiebel,项目名称:G2016,代码行数:37,代码来源:EntreesController.php

示例3: prep_page

function prep_page($template, $title = null, $local_vars = array(), $options = null)
{
    // Updates the quickstat via javascript if requested.
    $quickstat = @$options['quickstat'];
    $quickstat = $quickstat ? $quickstat : @$local_vars['quickstat'];
    $body_classes = isset($options['body_classes']) ? $options['body_classes'] : (isset($local_vars['body_classes']) ? $local_vars['body_classes'] : null);
    $is_index = @$options['is_index'];
    // *** Initialize the template object ***
    $tpl = new NWTemplate();
    $tpl->assignArray($local_vars);
    $user_id = self_char_id();
    // Character id.
    $player = Player::find($user_id);
    $public_char_info = $player ? $player->publicData() : [];
    // Char info to pass to javascript.
    $tpl->assign('logged_in', $user_id);
    $tpl->assign('user_id', $user_id);
    $tpl->assign('title', $title);
    $tpl->assign('quickstat', $quickstat);
    $tpl->assign('is_index', $is_index);
    $tpl->assign('json_public_char_info', $public_char_info ? json_encode($public_char_info) : null);
    $tpl->assign('body_classes', $body_classes);
    $tpl->assign('main_template', $template);
    return $tpl;
}
开发者ID:NinjaWars,项目名称:ninjawars,代码行数:25,代码来源:lib_templates.php

示例4: get_user_logged_in

 public static function get_user_logged_in()
 {
     if (isset($_SESSION['user'])) {
         $user_id = $_SESSION['user'];
         $user = Player::find($user_id);
         return $user;
     }
     return null;
 }
开发者ID:Jonharju,项目名称:Tsoha-Bootstrap,代码行数:9,代码来源:base_controller.php

示例5: findByTeam

 public static function findByTeam($team_id)
 {
     $query = DB::connection()->prepare('SELECT player_id FROM Teammember WHERE team_id = :team_id');
     $query->execute(array('team_id' => $team_id));
     $rows = $query->fetchAll();
     $Player = array();
     foreach ($rows as $row) {
         $Player[] = Player::find($row['player_id']);
     }
     return $Player;
 }
开发者ID:Jonharju,项目名称:Tsoha-Bootstrap,代码行数:11,代码来源:teammember.php

示例6: place

 public function place($backUrl = 'entree', $player_id, $id)
 {
     $entreePlayer = Entreeplayer::find($id);
     $player = Player::find($player_id);
     $entreePlayer->player_id = $player->id;
     $entreePlayer->hcp = $player->hcp;
     $entreePlayer->save();
     // get Categorie
     $entreePlayer->competcategorie_id = $entreePlayer->getCategorie();
     $entreePlayer->save();
     return Redirect::route($backUrl);
 }
开发者ID:birdiebel,项目名称:G2016,代码行数:12,代码来源:EntreeplayersController.php

示例7: CreatePlayer

 public static function CreatePlayer($server, $name)
 {
     // Try and find a player with this name on this server
     $server_id = mysql_real_escape_string($server->id);
     $name = mysql_real_escape_string($name);
     $player = Player::find("gameserver_id = '{$server_id}' AND players.name = '{$name}'");
     if (!$player) {
         $player = new Player();
     }
     $player->name = $name;
     $player->server = $server;
     $player->gameserver_id = $server->id;
     return $player;
 }
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:14,代码来源:player.model.php

示例8: get_admin_logged_in

 public static function get_admin_logged_in()
 {
     // Katsotaan onko user-avain sessiossa
     if (isset($_SESSION['user'])) {
         $user_id = $_SESSION['user'];
         // Pyydetään User-mallilta käyttäjä session mukaisella id:llä
         $user = Player::find($user_id);
         if (Player::is_admin($user_id)) {
             return $user;
         }
         return null;
     }
     // Käyttäjä ei ole kirjautunut sisään
     return null;
 }
开发者ID:rryanburton,项目名称:Tsoha-Bootstrap,代码行数:15,代码来源:base_controller.php

示例9: index

 public static function index()
 {
     $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 {
         // Make page from scratch
         $player = Player::find($_GET['player']);
         $game_count = Game::count_all_player_games($player->playerid);
         $latest_game = Game::latest_player_game($player->playerid);
         $high_scores = Game::player_high_scores($player->playerid);
         $years = Game::game_years();
         $popular_courses = Course::popular_courses($player->playerid);
         $throw_count = Score::count_all_player_scores($player->playerid);
         $birdies = Score::players_birdies($player->playerid);
         $aces = Score::players_aces($player->playerid);
         $courses_avg_scores = array();
         $names_done = false;
         foreach ($years as $year) {
             $avg_scores_by_year = Course::average_player_scoring_by_year($player->playerid, $year);
             for ($i = 0; $i < count($avg_scores_by_year); $i++) {
                 if (!$names_done) {
                     $averages = array();
                     $averages[] = $avg_scores_by_year[$i]['name'];
                     $courses_avg_scores[] = $averages;
                 }
                 if ($avg_scores_by_year[$i]['avg_score'] != null) {
                     $courses_avg_scores[$i][] = $avg_scores_by_year[$i]['avg_score'] . " (" . str_replace(" ", "", $avg_scores_by_year[$i]['to_par']) . ")";
                 } else {
                     $courses_avg_scores[$i][] = "";
                 }
             }
             $names_done = true;
         }
         $page_html = View::make('player/index.html', array('player' => $player, 'players' => Player::all(), 'game_count' => $game_count, 'throw_count' => $throw_count, 'latest_game' => $latest_game, 'high_scores' => $high_scores, 'popular_courses' => $popular_courses, 'birdies' => $birdies, 'aces' => $aces, 'years' => $years, 'courses_avg_scores' => $courses_avg_scores));
         if (Cache::on()) {
             Cache::store($stripped_url, $page_html);
         }
     }
 }
开发者ID:virtalas,项目名称:disc-golf-stats,代码行数:44,代码来源:player_controller.php

示例10: get_delete_player

 public function get_delete_player($playerId)
 {
     $player = Player::find($playerId);
     $response = array();
     if (!$player) {
         // no player exists
         $response['code'] = 404;
         $response['msg'] = 'This player does not exist.';
     } elseif ($player->delete()) {
         // success
         $response['code'] = 200;
         $response['msg'] = 'This player has been deleted.';
     } else {
         // fail
         $response['code'] = 500;
         $response['msg'] = 'This player could not be removed.';
     }
     return json_encode($response);
 }
开发者ID:kleitz,项目名称:brackets,代码行数:19,代码来源:bracket.php

示例11: findAction

 public function findAction()
 {
     $ident = $this->getRequest()->getParam('ident');
     $view = $this->initView();
     $player_table = new Player();
     $rowset = $player_table->find($ident);
     if ($rowset) {
         $view->player = $rowset->current();
         $view->alias = $player_table->getAlias($view->player->player_ident);
         $view->races = $player_table->getRaces($view->player->player_ident);
         $view->upgrades = $player_table->getUpgrades($view->player->player_ident);
         //$race_table = new Races();
         //$paginator = Zend_Paginator::factory($race_table->selectPlayerRaces($ident));
         //$paginator->setItemCountPerPage(1);
         //$paginator->setCurrentPageNumber($this->_getParam('page'));
         //$paginator->setView($view);
         //$this->view->paginator = $paginator;
         //$this->render();
     } else {
         $view->error = 'Player # "' . $ident . ' was not found';
     }
     $this->render();
 }
开发者ID:neffers,项目名称:Nefcraft,代码行数:23,代码来源:PlayerController.php

示例12: postEdit

 public function postEdit()
 {
     $rules = array('uid' => 'required|numeric|exists:players,uid', 'playerid' => 'required|numeric|exists:players,playerid', 'donatorlvl' => 'numeric|min:0|max:5', 'reason' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes() && Auth::user()->canEditPlayerAdmin(Input::get('playerid'))) {
         $player = Player::find(Input::get('uid'));
         $log = new Adminlog();
         $log->type = 'player';
         $log->editor = Auth::user()->id;
         $log->objectid = Input::get('uid');
         $log->reason = Input::get('reason');
         $log->difference = $log->getDifference(array('donatorlvl' => $player->donatorlvl, 'donatordate' => $player->donatordate, 'donatoramount' => $player->donatoramount, 'donatorduration' => $player->donatorduration), array('donatorlvl' => Input::get('donatorlvl'), 'donatordate' => Input::get('donatordate'), 'donatoramount' => Input::get('donatoramount') * 1, 'donatorduration' => Input::get('donatorduration')));
         $log->save();
         $player->donatorlvl = Input::get('donatorlvl');
         $player->donatordate = Input::get('donatordate');
         $player->donatoramount = Input::get('donatoramount') * 1;
         $player->donatorduration = Input::get('donatorduration');
         $player->save();
         return Redirect::to('/donators')->with(array('message' => 'Die Änderung wurde erfolgreich übernommen.', 'type' => 'success'));
     } else {
         return Redirect::to('/donators')->with(array('message' => 'Leider ist ein Fehler aufgetreten, die Änderung wurde verworfen.', 'type' => 'danger'));
     }
 }
开发者ID:GlitchedMan,项目名称:a3l-webinterface,代码行数:23,代码来源:DonatorsController.php

示例13: showPlayers

    private function showPlayers()
    {
        $players = Player::find('teamid = ? and name != ? and seasonid = ? order by number asc',
            [$this->team->teamid, '', $this->season->seasonid]);
        if (!$players) return;

        $playersByNumber = Model::indexBy($players, 'number');

        ?>
        <h2>Jugadores iniciales</h2>
        <? for ($y=0; $y*3 < $this->season->teamplayers; $y++) {
        ?><table>
        <thead>
        <tr>
            <?
            $colspan = 1;
            for ($x=0; $x<3; $x++) {
                if ($x != 2 && ($this->tiers[$y*3 + $x] == $this->tiers[$y*3 + $x + 1])) {
                    $colspan++;
                }
                else {
                    ?>
                    <td colspan="<?=$colspan?>">
                        <?= $this->tiers[$y*3 + $x] ?>
                    </td>
                    <?
                    $colspan = 1;
                }
            } ?>
        </tr>
        </thead><tr><?
            for ($x=0; $x<3; $x++) {
                $number = $y*3 + $x + 1;
                $player = $playersByNumber[$number];
                $playerLink = preg_replace("'\\-[0-9]$'", "", $player->name);
                $infoLink = "http://www.smogon.com/dex/xy/pokemon/{$playerLink}/";
                ?>
                <td>
                    <div style="width: 144px">
                        <? if ($player) { ?>
                            <div class="inblock middle" style="text-align: center">
                                <a href="<?=$infoLink?>" target="_blank" title="Ver en Smogon">
                                    <img src="/img/sprites/<?= $player->name ?>.png">
                                </a>
                            </div><br>
                            <a href="<?=$infoLink?>" target="_blank" title="Ver en Smogon">
                                <b><?= ucwords($player->name) ?></b>
                            </a>
                        <? } else { ?>
                            <div class="inblock middle" style="text-align: center">
                                <div style="width:100px; height:100px"
                            </div><br>
                        <? } ?>
                    </div>
                </td>
                <?
            }
            ?></tr></table>
        <div style="height: 6px"></div><?
    } ?>
        <?
    }
开发者ID:xJakub,项目名称:LCE,代码行数:62,代码来源:Team_Index.php

示例14: postEdit

 public function postEdit()
 {
     $rules = array('uid' => 'required|numeric|exists:players,uid', 'playerid' => 'required|numeric|exists:players,playerid', 'cash' => 'numeric', 'bankacc' => 'numeric', 'coplevel' => 'numeric|min:0|max:11', 'mediclevel' => 'numeric|min:0|max:5', 'adaclevel' => 'numeric|min:0|max:5', 'adminlevel' => 'numeric|min:0|max:3', 'reason' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     $civ_licenses = array(array('license_civ_sec', 0), array('license_civ_donator', 0), array('license_civ_home', 0), array('license_civ_rebel', 0), array('license_civ_bm', 0), array('license_civ_gun', 0), array('license_civ_driver', 0), array('license_civ_truck', 0), array('license_civ_air', 0), array('license_civ_boat', 0), array('license_civ_dive', 0), array('license_civ_heroin', 0), array('license_civ_coke', 0), array('license_civ_marijuana', 0), array('license_civ_oil', 0), array('license_civ_diamond', 0), array('license_civ_copper', 0), array('license_civ_iron', 0), array('license_civ_sand', 0), array('license_civ_salt', 0), array('license_civ_cement', 0), array('license_civ_brauer', 0), array('license_civ_wein', 0), array('license_civ_zigaretten', 0), array('license_civ_zucker', 0), array('license_civ_whiskey', 0), array('license_civ_zigarren', 0), array('license_civ_rum', 0), array('license_civ_holz', 0), array('license_civ_schwefel', 0), array('license_civ_silber', 0), array('license_civ_zinn', 0), array('license_civ_gusseisen', 0), array('license_civ_bronze', 0), array('license_civ_schmuck', 0), array('license_civ_good', 0), array('license_civ_bus', 0), array('license_civ_taxi', 0), array('license_civ_hunting', 0));
     $cop_licenses = array(array('license_cop_air', 0), array('license_cop_sek', 0), array('license_cop_cg', 0));
     $med_licenses = array(array('license_med_air', 0), array('license_med_mohawk', 0));
     $adac_licenses = array(array('license_adac_car', 0), array('license_adac_air', 0));
     if ($validator->passes() && Auth::user()->canEditPlayerAdmin(Input::get('playerid'))) {
         foreach (Input::all() as $str_key => $value) {
             $subStr = substr($str_key, 0, 12);
             if ($subStr == 'license_civ_') {
                 foreach ($civ_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $civ_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
             if ($subStr == 'license_cop_') {
                 foreach ($cop_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $cop_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
             if ($subStr == 'license_med_') {
                 foreach ($med_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $med_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
             if ($subStr == 'license_adac') {
                 foreach ($adac_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $adac_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
         }
         $civ_licenses = Auth::user()->encodeDBArray($civ_licenses);
         $cop_licenses = Auth::user()->encodeDBArray($cop_licenses);
         $med_licenses = Auth::user()->encodeDBArray($med_licenses);
         $adac_licenses = Auth::user()->encodeDBArray($adac_licenses);
         $player = Player::find(Input::get('uid'));
         $log = new Adminlog();
         $log->type = 'player';
         $log->editor = Auth::user()->id;
         $log->objectid = Input::get('uid');
         $log->reason = Input::get('reason');
         $log->difference = $log->getDifference(array('cash' => $player->cash, 'bankacc' => $player->bankacc, 'coplevel' => $player->coplevel, 'mediclevel' => $player->mediclevel, 'adaclevel' => $player->adaclevel, 'civ_licenses' => $player->civ_licenses, 'cop_licenses' => $player->cop_licenses, 'med_licenses' => $player->med_licenses, 'adac_licenses' => $player->adac_licenses, 'adminlevel' => $player->adminlevel), array('cash' => Input::get('cash') * 1, 'bankacc' => Input::get('bankacc') * 1, 'coplevel' => Input::get('coplevel') * 1, 'mediclevel' => Input::get('mediclevel') * 1, 'adaclevel' => Input::get('adaclevel') * 1, 'civ_licenses' => $civ_licenses, 'cop_licenses' => $cop_licenses, 'med_licenses' => $med_licenses, 'adac_licenses' => $adac_licenses, 'adminlevel' => Input::get('adminlevel')));
         $log->save();
         $player->cash = Input::get('cash');
         $player->bankacc = Input::get('bankacc');
         $player->coplevel = Input::get('coplevel');
         $player->mediclevel = Input::get('mediclevel');
         $player->adaclevel = Input::get('adaclevel');
         $player->civ_licenses = $civ_licenses;
         $player->cop_licenses = $cop_licenses;
         $player->med_licenses = $med_licenses;
         $player->adac_licenses = $adac_licenses;
         $player->adminlevel = Input::get('adminlevel');
         $player->save();
         return Redirect::to('/players')->with(array('message' => 'Die Änderung wurde erfolgreich übernommen.', 'type' => 'success'));
     } elseif ($validator->passes() && Auth::user()->canEditPlayerMoney(Input::get('playerid'))) {
         foreach (Input::all() as $str_key => $value) {
             $subStr = substr($str_key, 0, 12);
             if ($subStr == 'license_civ_') {
                 foreach ($civ_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $civ_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
             if ($subStr == 'license_cop_') {
                 foreach ($cop_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $cop_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
             if ($subStr == 'license_med_') {
                 foreach ($med_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $med_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
             if ($subStr == 'license_adac') {
                 foreach ($adac_licenses as $int_key => $array) {
                     if ($array[0] == $str_key) {
                         $adac_licenses[$int_key][1] = $value * 1;
                     }
                 }
             }
         }
         $civ_licenses = Auth::user()->encodeDBArray($civ_licenses);
         $cop_licenses = Auth::user()->encodeDBArray($cop_licenses);
         $med_licenses = Auth::user()->encodeDBArray($med_licenses);
         $adac_licenses = Auth::user()->encodeDBArray($adac_licenses);
//.........这里部分代码省略.........
开发者ID:GlitchedMan,项目名称:a3l-webinterface,代码行数:101,代码来源:PlayersController.php

示例15: openContent

{{ openContent('Eloquent') }}

    <?php 
$player = Player::find(1);
$competCategorie = Competcategorie::with('categorie')->leftJoin('categories', 'competcategories.categorie_id', '=', 'categories.id')->select('competcategories.id')->where('categories.sexe_id', '=', $player->sexe_id)->first();
dd($competCategorie->id);
?>

    <p>Count = {{ $players->count() }}</p>

    @foreach($players as $player)
        {{ $player->nom }} | {{ $player->club->nom }}
        <hr>
    @endforeach

{{ closeContent() }}
开发者ID:birdiebel,项目名称:G2016,代码行数:16,代码来源:testAjax2.blade.php


注:本文中的Player::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。