BookmakerOffer wip

This commit is contained in:
salam committed 2026-01-12 10:16:47 +01:00
1 parent 7e820268f4
commit d8eb4f2841
1 file changed
+11 -5
@@ -4,6 +4,7 @@ namespace App\Console\Commands\Grapper\Helper;
use App\Console\Commands\Nuh;
use App\Models\BookmakerSport;
use App\Utilities\Notice;
class BookmakerOffer
{
@@ -16,16 +17,15 @@ class BookmakerOffer
public static function init()
{
$debug = Nuh::$options['d'] ?? 0;
if (Nuh::$options['d'] == 'bkms') {
if (Nuh::$options['f'] == 'bkms') {
self::$collector = [];
}
}
public static function collect($bookmaker_id, $sport_id)
{
if (Nuh::$options['d'] == 'bkms') {
if (Nuh::$options['f'] == 'bkms') {
if (! isset(self::$collector[$sport_id])) {
self::$collector[$sport_id] = [];
}
@@ -38,13 +38,15 @@ class BookmakerOffer
public static function finalize()
{
if (Nuh::$options['d'] == 'bkms') {
if (Nuh::$options['f'] == 'bkms') {
$arr = [];
foreach (self::$collector as $sport_id => $bookmaker_ids) {
BookmakerSport::where('provider_id', Nuh::$options['provider_id'])
->where('sport_id', (int) $sport_id)
->update(['is_active' => 0]);
foreach ($bookmaker_ids as $bookmaker_id) {
$arr[] = $bookmaker_id;
BookmakerSport::updateOrCreate([
'provider_id' => Nuh::$options['provider_id'],
'bookmaker_id' => (int) $bookmaker_id,
@@ -54,7 +56,11 @@ class BookmakerOffer
]);
}
}
}
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note($arr, 'p', 1);
}
}
}
}