30 lines
792 B
PHP
30 lines
792 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands\Services\Tasks\Alarm;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class AlarmLoadOdds
|
|
{
|
|
public static function get($event_id, $table, $oddnames)
|
|
{
|
|
$res = DB::table($table)->where('flags', 1)->where('event_id', $event_id)->get();
|
|
|
|
$odds = explode(',', $oddnames);
|
|
|
|
$arr = [];
|
|
foreach ($res as $value) {
|
|
if ($table == 'odds_dc') {
|
|
$arr[(int) $value->bookmaker_id]['margin'] = (float) $value->margin * 2;
|
|
} else {
|
|
$arr[(int) $value->bookmaker_id]['margin'] = (float) $value->margin;
|
|
}
|
|
foreach ($odds as $odd) {
|
|
$arr[(int) $value->bookmaker_id][$odd] = (float) $value->$odd;
|
|
}
|
|
}
|
|
|
|
return $arr;
|
|
}
|
|
}
|