PairFirstMatch.php 655 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App\Services\Pair;
  3. use App\Models\Fpdx\PairModel;
  4. use App\Services\Pair\DataModels\PairMatchDataSource;
  5. class PairFirstMatch extends BasePairMatch
  6. {
  7. public function __construct(int $stageId)
  8. {
  9. parent::__construct();
  10. $this->stageId = $stageId;
  11. }
  12. public function loadMatchData()
  13. {
  14. $datas = PairModel::where([
  15. array('stage_id', $this->stageId), array('state', '>', 100)
  16. ])->whereNull('assoc_id')->get()->sortByDesc('score')->toArray();
  17. $this->dataSources = array_map(function ($data) {
  18. return new PairMatchDataSource($data);
  19. }, $datas);
  20. }
  21. }