fix
This commit is contained in:
1 parent
4afe60a957
commit
24dbbd7fea
16 files changed
+48
-52
No files matched your search
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Magloo\Odds;
|
||||
|
||||
use App\Models\OddsTq;
|
||||
use App\Utilities\Margin;
|
||||
|
||||
class MaglooStoreTq
|
||||
{
|
||||
public static function store($value, $base)
|
||||
{
|
||||
$odds = [];
|
||||
$odds['htq'] = number_format($value['static'][4], 2) ?? 1;
|
||||
$odds['atq'] = number_format($value['static'][5], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = OddsTq::where('event_id', $base['event_id'])->where('bookmaker_id', $base['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTq::create($odds);
|
||||
} else {
|
||||
$res->htq = $odds['htq'];
|
||||
$res->atq = $odds['atq'];
|
||||
if ($res->isDirty()) {
|
||||
$res->oddchange_at = now();
|
||||
}
|
||||
$res->checked_at = $odds['checked_at'];
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user