コード例 #1
0
ファイル: Slot.php プロジェクト: arkivalenciaii/clientv2
 public function rank($slot)
 {
     if (\App\Ranking::where('slot_code', '=', $slot->slot_code)->exists() == false) {
         $rank = new \App\Ranking();
         $rank->slot_code = $slot->slot_code;
         $rank->user_id = $slot->user_id;
         $rank->save();
         $rank->slot_rank = $rank->id;
         $rank->slot_exit = 0;
         $rank->save();
         $tv1 = $rank->id;
         $tv2 = $rank->id * 2;
         $tv3 = $tv2 * 2;
         $tree = new \App\Tree();
         $tree->down1 = $tv2;
         $tree->down2 = $tv2 + 1;
         $tree->down3 = $tv3;
         $tree->down4 = $tv3 + 1;
         $tree->down5 = $tv3 + 2;
         $tree->down6 = $tv3 + 3;
         $tree->save();
         $rank->tree_id = $tree->id;
         $rank->save();
     }
 }
コード例 #2
0
 /**
  * Store a newly created Cruiseline.
  *
  * @param Request $request
  * @param Cruiseline $brand
  * @return mixed
  */
 public function store(CreateRank $request)
 {
     $rankings = Ranking::where('rankable_type', '=', 'App\\Brochure')->delete();
     $rankable_type = $request->rankable_type;
     $count = count($request->rankable_id);
     for ($i = 0; $i < $count; $i++) {
         $ranking = Ranking::create(['rank' => $i + 1, 'rankable_type' => $rankable_type, 'rankable_id' => $request->rankable_id[$i]]);
     }
     return redirect('home/brochurerankings');
 }
コード例 #3
0
ファイル: routes.php プロジェクト: jenidarnold/racquetball
    if (get_headers('http://www.r2sports.com/tourney/imageGallery/gallery/player/' . $player_id . '_normal.jpg')[0] != 'HTTP/1.1 404 Not Found') {
        $profile = 'http://www.r2sports.com/tourney/imageGallery/gallery/player/' . $player_id . '_normal.jpg';
    } else {
        $profile = '/images/racquet-right.png';
    }
    return $profile;
});
Route::get('api/rankings/history', function () {
    $player_id = (int) Input::get('player_id');
    $group_id = Input::get('group_id');
    $location_id = (int) Input::get('location_id');
    $location = Location::find($location_id);
    $player = Player::find($player_id);
    $rankings = Ranking::where('player_id', '=', $player_id)->select('ranking_date', 'location_id', 'ranking')->orderBy('ranking_date')->get();
    /*National Ranking*/
    $national = Ranking::where('player_id', '=', $player_id)->where('location_id', '=', 0)->select('ranking_date', 'ranking')->orderBy('ranking_date')->get();
    $query = "\n\t\tSELECT \n\t\t\tdate_format(ranking_date, '%m/%d/%Y') as ranking_date,\n\t\t\tranking\n\t\tFROM\n\t\t\trankings\n\t\tWHERE\n\t\t\tplayer_id = {$player_id}\n\t\t\tAND location_id = 0\n\t\t\tAND group_id = {$group_id}\n\t\tORDER BY \n\t\t\tranking_date\n\t\t";
    $national = \DB::select(DB::raw($query));
    $arr_national = array();
    foreach ($national as $key => $n) {
        $row = array();
        $row['ranking_date'] = $n->ranking_date;
        $row['National'] = intval($n->ranking);
        array_push($arr_national, $row);
    }
    //dd($player);
    /*State Ranking*/
    $query = "\n\t\tSELECT \n\t\t\tdate_format(ranking_date, '%m/%d/%Y') as ranking_date,\n\t\t\tranking\n\t\tFROM\n\t\t\trankings\n\t\tWHERE\n\t\t\tplayer_id = {$player_id}\n\t\t\tAND group_id = {$group_id}\n\t\t\tAND location_id = {$location_id}\n\t\tORDER BY \n\t\t\tranking_date\n\t\t";
    $state = \DB::select(DB::raw($query));
    $arr_state = array();
    foreach ($state as $key => $n) {