marcelotk15 / round-robin
RoundRobin for Laravel 5.8+.
Installs: 5 469
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 6
Open Issues: 1
Requires
- php: >=5.6.4
Requires (Dev)
- phpunit/phpunit: 5.5.*
This package is auto-updated.
Last update: 2024-10-29 04:20:09 UTC
README
Round-Robin is an easy way to create schedule with round-robin(rr) technique. I used the mnito's base code for this. Look here: https://github.com/mnito/round-robin
Installation
- In order to install Laravel Round-Robin, just add the following to your composer.json. Then run
composer update
:
"marcelotk15/round-robin": "0.1.*"
or run composer require marcelotk15/round-robin
- Open your
config/app.php
and add the following to theproviders
array:
Laravel\RoundRobin\RoundRobinServiceProvider::class,
- Open your
config/app.php
and add the following to thefacades
array:
'RoundRobin' => Laravel\RoundRobin\RoundRobinFacade::class,
Controllers and etc
use Laravel\RoundRobin\RoundRobin;
Using (Examples)
Setuping (without Facade):
$teams = ['Arsenal', 'Atlético de Madrid', 'Borussia', 'Barcelona','Liverpool', 'Bayer 04', 'Real Madrid']; $schedule = new RoundRobin($teams)->make(); // or with 'from' static method $schedule = RoundRobin::from($teams)->make();
With a facade:
$teams = ['Arsenal', 'Atlético de Madrid', 'Borussia', 'Barcelona','Liverpool', 'Bayer 04', 'Real Madrid']; $schedule = RoundRobin::from($teams)->make();
Generate a schedule without randomly shuffling the teams using the $shuffle boolean parameter:
$teams = ['Arsenal', 'Atlético de Madrid', 'Borussia', 'Barcelona','Liverpool', 'Bayer 04', 'Real Madrid']; $schedule = RoundRobin::from($teams)->doNotShuffle()->make();
Use your own seed with the $seed integer parameter for predetermined shuffling:
$teams = ['Arsenal', 'Atlético de Madrid', 'Borussia', 'Barcelona','Liverpool', 'Bayer 04', 'Real Madrid']; $schedule = RoundRobin::from($teams)->shuffle(15)->make();
If you want a double Round-robin:
$teams = ['Arsenal', 'Atlético de Madrid', 'Borussia', 'Barcelona','Liverpool', 'Bayer 04', 'Real Madrid']; $schedule = RoundRobin::from($teams)->doubleRoundRobin()->make();
If you want a get a Schedule Object:
$teams = ['Arsenal', 'Atlético de Madrid', 'Borussia', 'Barcelona','Liverpool', 'Bayer 04', 'Real Madrid']; $schedule = RoundRobin::from($teams)->makeSchedule();
License
Laravel Round-Robin is free software distributed under the terms of the MIT license.