43 lines
1.3 KiB
PHP
43 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
|
|
|
use App\Console\Commands\NuhBash;
|
|
use App\Models\OddsQualify;
|
|
use App\Utilities\Margin;
|
|
use App\Utilities\Notice;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
class _Tq
|
|
{
|
|
public static function grap($odds, $offer)
|
|
{
|
|
$debug = NuhBash::$options['d'] ?? 0;
|
|
|
|
if ($debug) {
|
|
Notice::note('To Qualify '.NuhBash::$bookmaker_id, 'b');
|
|
}
|
|
|
|
$update_array = [];
|
|
foreach ($offer as $value) {
|
|
$update_array['hta'] = (float) $value->o1;
|
|
$update_array['atq'] = (float) $value->o3;
|
|
}
|
|
$update_array['margin'] = (float) Margin::calculate($update_array, 1);
|
|
|
|
$update_array['bmoid'] = $odds['bmoid'];
|
|
$update_array['sport_id'] = $odds['sport_id'];
|
|
$update_array['offer_id'] = $odds['offer_id'];
|
|
$update_array['flag'] = 1;
|
|
$update_array['provider_id'] = $odds['provider_id'];
|
|
$update_array['nuh_check'] = 0;
|
|
$update_array['last_check_at'] = Carbon::now()->toDateTimeString();
|
|
$update_array['source_updated_at'] = $odds['source_updated_at'];
|
|
|
|
OddsQualify::updateOrCreate([
|
|
'event_id' => NuhBash::$_event->id,
|
|
'bookmaker_id' => NuhBash::$bookmaker_id,
|
|
], $update_array);
|
|
}
|
|
}
|