Files
nuhodds_fi4/app/Console/Commands/Grapper/Betsapi/Bet365.php
T
2025-12-22 08:15:59 +01:00

47 lines
1.2 KiB
PHP

<?php
namespace App\Console\Commands\Grapper\Betsapi;
use App\Console\Commands\Curl;
use App\Console\Commands\Nuh;
use App\Models\Event;
use App\Utilities\Notice;
class Bet365
{
public static function grap()
{
$debug = Nuh::$options['d'] ?? 0;
/**
* Bet365
*/
$bookmaker_id = 126;
$res = Event::where('bet365_id', '>', 0)->pluck('id', 'bet365_id');
foreach ($res as $bet365_id => $txodds_id) {
/**
* BET365 ODDS (per event)
*/
$url = 'https://api.b365api.com/v4/bet365/prematch?token='.config('env.betsapi_token').'&FI='.$bet365_id;
$data = Curl::load($url);
dd($data);
$betsapi_id = $data['results'][0]['id'] ?? 0;
$bet365_id = $data['results'][0]['bet365_id'] ?? 0;
if ($debug) {
Notice::note(["TXdds ID : $txodds_id", "Betsapi ID : $betsapi_id", "Bet365 ID : $bet365_id", "Willhill ID : $willhill_id"], 'b');
}
if ($betsapi_id) {
Event::where('id', (int) $txodds_id)->update(['betsapi_id' => $betsapi_id, 'bet365_id' => $bet365_id]);
}
}
}
}