PHP code example of tonystore / laravel-round-robin
1. Go to this page and download the library: Download tonystore/laravel-round-robin library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$teams = ['BSC','CSE','CUMBAYA','U. CATOLICA','LDU','AUCAS','GUALACEO','ORENSE','CITY','TU','D. CUENCA','MUSHUCRUNA','IDV','DELFIN','MACARA','9 DE OCTUBRE'];
$schedule = RoundRobin::addTeams($teams)->doNotShuffle()->schedule();
$teams = ['BSC','CSE','CUMBAYA','U. CATOLICA','LDU','AUCAS','GUALACEO','ORENSE','CITY','TU','D. CUENCA','MUSHUCRUNA','IDV','DELFIN','MACARA','9 DE OCTUBRE'];
$schedule = RoundRobin::addTeams($teams)->shuffle(12)->schedule();
$teams = ['BSC','CSE','CUMBAYA','U. CATOLICA','LDU','AUCAS','GUALACEO','ORENSE','CITY','TU','D. CUENCA','MUSHUCRUNA','IDV','DELFIN','MACARA','9 DE OCTUBRE'];
$schedule = RoundRobin::addTeams($teams)->schedule();
$schedule->first(); //It will return the first round available on the connection.
$schedule->last(); //It will return the last round available on the connection.
$teams = ['BSC','CSE','CUMBAYA','U. CATOLICA','LDU','AUCAS','GUALACEO','ORENSE','CITY','TU','D. CUENCA','MUSHUCRUNA','IDV','DELFIN','MACARA','9 DE OCTUBRE'];
$schedule = RoundRobin::addTeams($teams)->schedule()->toObject();
$schedule[0][0]->local; //It will return the name of the home team, of the first game, of the first available round.
$teams = ['BSC','CSE','CUMBAYA','U. CATOLICA','LDU','AUCAS','GUALACEO','ORENSE','CITY','TU','D. CUENCA','MUSHUCRUNA','IDV','DELFIN','MACARA','9 DE OCTUBRE'];
$schedule = RoundRobin::addTeams($teams)->doubleRound()->schedule();
$teams = ['BSC','CSE','CUMBAYA','U. CATOLICA','LDU','AUCAS','GUALACEO','ORENSE','CITY','TU','D. CUENCA','MUSHUCRUNA','IDV','DELFIN','MACARA','9 DE OCTUBRE'];
$schedule = RoundRobin::addTeams($teams)->doubleRound()->schedule();
$firstLeg = $schedule->firstLeg(); //Will return only for the first leg.
$secondLeg = $schedule->secondLeg(); //Will return only for the second leg.
php
return [
/**
*----------------------------------------------------------------------
* Minimum number of teams to generate a schedule
*----------------------------------------------------------------------
*/
'min_teams' => 2,
/**
*----------------------------------------------------------------------
* Custom name for the first phase of the schedule.
*----------------------------------------------------------------------
*/
'one_phase' => 'one',
/**
*----------------------------------------------------------------------
* Custom name for the return phase of the schedule.
*----------------------------------------------------------------------
*/
'way_phase' => 'way',
]
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.