wip del err
This commit is contained in:
1 parent
812736ca9a
commit
9bcd4432c6
1210 files changed
-220941
No files matched your search
@@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Models\OddsTotal;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LogifutureStoreTotals
|
||||
{
|
||||
public static function store(&$_spreads, $base)
|
||||
{
|
||||
ActiveHandicap::set($_spreads);
|
||||
|
||||
foreach ($_spreads as $total => $value) {
|
||||
// code...
|
||||
$odds = [];
|
||||
$odds['over'] = $value['ele1'];
|
||||
$odds['under'] = $value['ele2'];
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['active_spread'] = $value['active_spread'];
|
||||
$odds['flags'] = 1;
|
||||
$odds['total'] = $total;
|
||||
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = OddsTotal::where('event_id', $base['event_id'])
|
||||
->where('bookmaker_id', $base['bookmaker_id'])
|
||||
->where('total', $odds['total'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotal::create($odds);
|
||||
} else {
|
||||
$res->over = number_format($odds['over'], 2);
|
||||
$res->under = number_format($odds['under'], 2);
|
||||
$res->total = number_format($odds['total'], 2);
|
||||
$res->active_spread = $odds['active_spread'];
|
||||
$res->difference = $odds['difference'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user