38 lines
1.1 KiB
PHP
38 lines
1.1 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 '.$odds['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['offer_id'] = $odds['offer_id'];
|
|
$update_array['flag'] = 1;
|
|
$update_array['nuh_check'] = 0;
|
|
$update_array['last_check_at'] = Carbon::now()->toDateTimeString();
|
|
$update_array['source_updated_at'] = $odds['source_updated_at'];
|
|
|
|
OddsQualify::updateOrCreate($odds, $update_array);
|
|
}
|
|
}
|