protected function generateFights()
    {
        //  First Round Fights
        $settings = $this->settings;
        $initialRound = 1;
        // Very specific case to common case : Preliminary with 3 fighters
        if ($this->championship->hasPreliminary() && $settings->preliminaryGroupSize == 3) {
            // First we make all first fights of all groups
            // Then we make all second fights of all groups
            // Then we make all third fights of all groups
            $groups = $this->championship->groupsByRound(1)->get();
            foreach ($groups as $numGroup => $group) {
                for ($numFight = 1; $numFight <= $settings->preliminaryGroupSize; $numFight++) {
                    $fight = new PreliminaryFight();
                    $order = $numGroup * $settings->preliminaryGroupSize + $numFight;
                    $fight->saveFight2($group, $numFight, $order);
                }
            }
            $initialRound++;
        }
        // Save Next rounds
        $fight = new SingleEliminationFight();
        $fight->saveFights($this->championship, $initialRound);
    }
protected function generateFights()
    {
        //  First Round Fights
        $settings = $this->settings;
        $initialRound = 1;
        // Very specific case to common case : Preliminary with 3 fighters
        if ($this->championship->hasPreliminary() && $settings->preliminaryGroupSize == 3) {
            // First we make all first fights of all groups
            // Then we make all second fights of all groups
            // Then we make all third fights of all groups
            $groups = $this->championship->groupsByRound(1)->get();
            foreach ($groups as $numGroup => $group) {
                for ($numFight = 1; $numFight <= $settings->preliminaryGroupSize; $numFight++) {
                    $fight = new PreliminaryFight();
                    $order = $numGroup * $settings->preliminaryGroupSize + $numFight;
                    $fight->saveFight2($group, $numFight, $order);
                }
            }
            $initialRound++;
        }
        // Save Next rounds
        $fight = new SingleEliminationFight();
        $fight->saveFights($this->championship, $initialRound);
    }
protected function generateFights ( ) { //  First Round Fights $ settings = $ this -> settings ; $ initialRound = 1 ; // Very specific case to common case : Preliminary with 3 fighters if ( $ this -> championship -> hasPreliminary ( ) && $ settings -> preliminaryGroupSize == 3 ) { // First we make all first fights of all groups // Then we make all second fights of all groups // Then we make all third fights of all groups $ groups = $ this -> championship -> groupsByRound ( 1 ) -> get ( ) ; foreach ( $ groups as $ numGroup => $ group ) { for ( $ numFight = 1 ; $ numFight <= $ settings -> preliminaryGroupSize ; $ numFight ++ ) { $ fight = new PreliminaryFight ( ) ; $ order = $ numGroup * $ settings -> preliminaryGroupSize + $ numFight ; $ fight -> saveFight2 ( $ group , $ numFight , $ order ) ; } } $ initialRound ++ ; } // Save Next rounds $ fight = new SingleEliminationFight ( ) ; $ fight -> saveFights ( $ this -> championship , $ initialRound ) ; }
Generate First Round Fights.
Generate First Round Fights .