diff --git a/app/Console/Commands/Grapper/Helper/BookmakerOffer.php b/app/Console/Commands/Grapper/Helper/BookmakerOffer.php index 60c3213a..63ff3935 100644 --- a/app/Console/Commands/Grapper/Helper/BookmakerOffer.php +++ b/app/Console/Commands/Grapper/Helper/BookmakerOffer.php @@ -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); + } + } } }