diff --git a/app/Actions/BettypUserGenerator.php b/app/Actions/BettypUserGenerator.php index 6516a445..4feacb7d 100644 --- a/app/Actions/BettypUserGenerator.php +++ b/app/Actions/BettypUserGenerator.php @@ -2,26 +2,29 @@ namespace App\Actions; -use App\Models\BettypeUser; use App\Models\MultilineSetting; +use DB; use Filament\Notifications\Notification; class BettypUserGenerator { public static function run($record) { - $user_id = $record->id; + $user_id = (int) $record->id; - $multilines = MultilineSetting::select('id', 'sport_id')->get(); + $multilines = MultilineSetting::orderBy('sport_id')->pluck('sport_id', 'id'); - foreach ($multilines as $multiline) { + foreach ($multilines as $multiline_setting_id => $sport_id) { - $is_active = in_array($multiline->id, [1, 6, 7, 10, 8, 12, 15, 16, 17]) ? 1 : 0; + $is_active = in_array($multiline_setting_id, [1, 2, 9, 10, 16, 17, 22, 23]) ? 1 : 0; + + $setting = []; + $setting['sport_id'] = $sport_id; + $setting['user_id'] = $user_id; + $setting['multiline_setting_id'] = $multiline_setting_id; + + DB::table('bettype_users')->updateOrInsert($setting, ['is_active' => $is_active]); - BettypeUser::updateOrCreate( - ['user_id' => (int) $user_id, 'multiline_setting_id' => (int) $multiline->id, 'sport_id' => (int) $multiline->sport_id], - ['is_active' => (int) $is_active] - ); } Notification::make() diff --git a/app/Actions/MultilineGenerator.php b/app/Actions/MultilineGenerator.php index 5580828c..da702e2f 100644 --- a/app/Actions/MultilineGenerator.php +++ b/app/Actions/MultilineGenerator.php @@ -4,6 +4,7 @@ namespace App\Actions; use App\Models\MultilineClient; use App\Models\MultilineSetting; +use DB; use Filament\Notifications\Notification; class MultilineGenerator @@ -16,27 +17,25 @@ class MultilineGenerator $bookmaker = [0, 6, 30, 649, 117]; - foreach ($record->sport as $sportid) { + foreach ($record->sport as $sport_id) { - $multilines = MultilineSetting::where('sport_id', $sportid)->get(); + $multilines = MultilineSetting::where('sport_id', $sport_id)->get(); foreach ($multilines as $multiline) { for ($i = 1; $i <= 4; $i++) { - MultilineClient::updateOrCreate( - [ - 'client_id' => $client_id, - 'sport_id' => $sportid, - 'multiline_setting_id' => $multiline->id, - 'position' => $i, - ], - [ - 'bookmaker_id' => $bookmaker[$i], - 'sort' => $i, - 'disabled' => 0, - ] - ); + $setting = []; + $setting['client_id'] = $client_id; + $setting['sport_id'] = $sport_id; + $setting['multiline_setting_id'] = $multiline->id; + $setting['position'] = $i; + + DB::table('multiline_clients')->updateOrInsert($setting, [ + 'bookmaker_id' => $bookmaker[$i], + 'sort' => $i, + 'disabled' => 0, + ]); } } diff --git a/app/Console/Commands/Grapper/TxOdds/Odds.php b/app/Console/Commands/Grapper/TxOdds/Odds.php index 569feb3a..82a1f105 100644 --- a/app/Console/Commands/Grapper/TxOdds/Odds.php +++ b/app/Console/Commands/Grapper/TxOdds/Odds.php @@ -131,9 +131,9 @@ class Odds case 5: /** * 1 2-WAY + * 131073 MONEY LINE - Q1 * 3 POINTS * 4 TOTALS - * 131073 MONEY LINE - Q1 */ $markets = '1,3,4,131073'; break; diff --git a/app/Models/BettypeUser.php b/app/Models/BettypeUser.php index bf3502ba..8793169e 100644 --- a/app/Models/BettypeUser.php +++ b/app/Models/BettypeUser.php @@ -13,6 +13,7 @@ class BettypeUser extends Model 'sport_id', 'multiline_setting_id', 'is_active', + 'unique_key', ]; protected static function booted(): void diff --git a/app/Models/Odds3wayHt.php b/app/Models/Odds3wayHt.php index 18335d48..d40072d5 100644 --- a/app/Models/Odds3wayHt.php +++ b/app/Models/Odds3wayHt.php @@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model; class Odds3wayHt extends Model { - protected $table = 'odds_3ways'; + protected $table = 'odds_3ways_ht'; protected $fillable = [ 'id', diff --git a/app/Models/OddsPointHt.php b/app/Models/OddsPointHt.php index da92a016..6f877cff 100644 --- a/app/Models/OddsPointHt.php +++ b/app/Models/OddsPointHt.php @@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model; class OddsPointHt extends Model { - protected $table = 'odds_points'; + protected $table = 'odds_points_ht'; protected $fillable = [ 'id', diff --git a/app/Models/OddsHandicapQ1.php b/app/Models/OddsPointQ1.php similarity index 100% rename from app/Models/OddsHandicapQ1.php rename to app/Models/OddsPointQ1.php diff --git a/app/Models/OddsTotalHt.php b/app/Models/OddsTotalHt.php index e3b4e315..170b68e7 100644 --- a/app/Models/OddsTotalHt.php +++ b/app/Models/OddsTotalHt.php @@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model; class OddsTotalHt extends Model { - protected $table = 'odds_totals'; + protected $table = 'odds_totals_ht'; protected $fillable = [ 'id', diff --git a/database/migrations/2024_11_08_053426_create_odds3way_ht_table.php b/database/migrations/2024_11_08_053426_create_odds3way_ht_table.php index 99ec9cd4..851aa472 100644 --- a/database/migrations/2024_11_08_053426_create_odds3way_ht_table.php +++ b/database/migrations/2024_11_08_053426_create_odds3way_ht_table.php @@ -11,7 +11,7 @@ return new class extends Migration */ public function up(): void { - Schema::create('odds3way_hts', function (Blueprint $table) { + Schema::create('odds_3ways_ht', function (Blueprint $table) { $table->id(); $table->foreignId('event_id')->index()->constrained()->cascadeOnDelete()->references('id')->on('events'); $table->integer('sport_id')->index()->references('id')->on('sports'); @@ -34,6 +34,6 @@ return new class extends Migration */ public function down(): void { - Schema::dropIfExists('odds3way_hts'); + Schema::dropIfExists('odds_3ways_ht'); } }; diff --git a/database/migrations/2024_11_08_053439_create_odds_points_q1_table.php b/database/migrations/2024_11_08_053439_create_odds_points_q1_table.php index 3005ddd1..995c1cdd 100644 --- a/database/migrations/2024_11_08_053439_create_odds_points_q1_table.php +++ b/database/migrations/2024_11_08_053439_create_odds_points_q1_table.php @@ -36,6 +36,6 @@ return new class extends Migration */ public function down(): void { - Schema::dropIfExists('odds_q1_points'); + Schema::dropIfExists('odds_points_q1'); } }; diff --git a/database/migrations/2024_11_08_053445_create_odds_points_ht_table.php b/database/migrations/2024_11_08_053445_create_odds_points_ht_table.php index cde6c5b3..3869de88 100644 --- a/database/migrations/2024_11_08_053445_create_odds_points_ht_table.php +++ b/database/migrations/2024_11_08_053445_create_odds_points_ht_table.php @@ -11,7 +11,7 @@ return new class extends Migration */ public function up(): void { - Schema::create('odds_point_ht', function (Blueprint $table) { + Schema::create('odds_points_ht', function (Blueprint $table) { $table->id(); $table->foreignId('event_id')->index()->constrained()->cascadeOnDelete()->references('id')->on('events'); $table->integer('sport_id')->index()->references('id')->on('sports'); @@ -35,6 +35,6 @@ return new class extends Migration */ public function down(): void { - Schema::dropIfExists('odds_point_ht'); + Schema::dropIfExists('odds_points_ht'); } }; diff --git a/database/migrations/2024_11_08_053445_create_odds_total_ht_table.php b/database/migrations/2024_11_08_053445_create_odds_total_ht_table.php index 6c25487d..90a2ee87 100644 --- a/database/migrations/2024_11_08_053445_create_odds_total_ht_table.php +++ b/database/migrations/2024_11_08_053445_create_odds_total_ht_table.php @@ -11,7 +11,7 @@ return new class extends Migration */ public function up(): void { - Schema::create('odds_total_hts', function (Blueprint $table) { + Schema::create('odds_totals_ht', function (Blueprint $table) { $table->id(); $table->foreignId('event_id')->index()->constrained()->cascadeOnDelete()->references('id')->on('events'); $table->integer('sport_id')->index()->references('id')->on('sports'); @@ -35,6 +35,6 @@ return new class extends Migration */ public function down(): void { - Schema::dropIfExists('odds_total_hts'); + Schema::dropIfExists('odds_totals_ht'); } }; diff --git a/database/migrations/2025_12_23_135116_create_bettype_users_table.php b/database/migrations/2025_12_23_135116_create_bettype_users_table.php index 1c512ccd..78c203bb 100644 --- a/database/migrations/2025_12_23_135116_create_bettype_users_table.php +++ b/database/migrations/2025_12_23_135116_create_bettype_users_table.php @@ -13,9 +13,9 @@ return new class extends Migration { Schema::create('bettype_users', function (Blueprint $table) { $table->id(); - $table->integer('user_id'); + $table->integer('user_id')->index(); $table->integer('sport_id')->index()->references('id')->on('sports'); - $table->integer('multiline_setting_id'); + $table->integer('multiline_setting_id')->index(); $table->boolean('is_active')->default(false); $table->timestamps(); }); diff --git a/database/seeders/MultilineSettingSeeder.php b/database/seeders/MultilineSettingSeeder.php index 0f7f985f..89b95173 100644 --- a/database/seeders/MultilineSettingSeeder.php +++ b/database/seeders/MultilineSettingSeeder.php @@ -12,26 +12,36 @@ class MultilineSettingSeeder extends Seeder /** * Clients */ - $sql = "INSERT INTO `multiline_settings` (`id`, `sport_id`, `name`, `short`, `table`, `rows`, `has_3_columns`, `created_at`, `updated_at`) + $sql = "INSERT INTO `multiline_settings` (`sport_id`, `name`, `short`, `table`, `rows`, `has_3_columns`, `created_at`, `updated_at`) VALUES - (1, 1, '1X2', '1X2', 'odds_3ways', 4, 1, '2025-12-14 09:25:48', '2025-12-14 09:25:48'), - (2, 1, 'DOUBLE CHANCE', 'DC', 'odds_dc', 4, 1, '2025-12-14 09:31:22', '2025-12-14 09:32:55'), - (3, 1, 'DRAW NO BET', 'DNB', 'odds_dnb', 4, 0, '2025-12-14 09:31:42', '2025-12-14 09:31:42'), - (4, 1, 'GOAL NO GOAL', 'GGNG', 'odds_ggng', 4, 0, '2025-12-14 09:31:56', '2025-12-14 09:31:56'), - (5, 1, 'TO QUALIFY', 'TQ', 'odds_tq', 4, 0, '2025-12-14 09:32:19', '2025-12-14 09:32:19'), - (6, 1, 'TOTALS', 'OU', 'odds_totals', 4, 1, '2025-12-14 09:32:38', '2025-12-14 09:32:38'), - (7, 3, 'MONEY LINE', 'ML', 'odds_2ways', 4, 0, '2025-12-14 09:37:32', '2025-12-14 09:37:32'), - (8, 3, 'HANDICAP', 'HC', 'odds_points', 4, 1, '2025-12-14 09:38:05', '2025-12-14 09:38:05'), - (9, 3, 'HANDICAP FIRST QUARTER', 'HCQ1', 'odds_points_q1', 4, 1, '2025-12-14 09:38:26', '2025-12-14 09:39:54'), - (10, 3, 'TOTALS', 'OU', 'odds_totals', 4, 1, '2025-12-14 09:38:44', '2025-12-14 09:38:44'), - (11, 3, 'TOTALS FIRST QUARTER', 'OUQ1', 'odds_totals_q1', 4, 1, '2025-12-14 09:39:12', '2025-12-14 09:39:59'), - (12, 2, 'MONEY LINE', 'ML', 'odds_2ways', 4, 0, '2025-12-14 09:41:21', '2025-12-14 09:41:21'), - (13, 2, '1X2', '1X2', 'odds_3ways', 4, 1, '2025-12-14 09:41:34', '2025-12-14 09:41:34'), - (14, 2, 'HANDICAP', 'HC', 'odds_points', 4, 1, '2025-12-14 09:41:56', '2025-12-14 09:41:56'), - (15, 2, 'TOTALS', 'OU', 'odds_totals', 4, 1, '2025-12-14 09:42:13', '2025-12-14 09:42:13'), - (16, 5, 'MONEY LINE', 'ML', 'odds_2ways', 4, 0, '2025-12-14 09:43:52', '2025-12-14 09:43:52'), - (17, 5, 'MONEY LINE SET 1', 'MLS1', 'odds_2ways_s1', 4, 0, '2025-12-14 09:44:13', '2025-12-14 09:44:13'), - (18, 5, 'TOTALS', 'OU', 'odds_totals', 4, 1, '2025-12-14 09:44:26', '2025-12-14 09:44:26'); + (1, '1X2', '1X2', 'odds_3ways', 4, 1, '2025-12-14 09:25:48', '2025-12-14 09:25:48'), + (1, 'TOTALS', 'OU', 'odds_totals', 4, 1, '2025-12-14 09:32:38', '2025-12-14 09:32:38'), + (1, '1X2 HALF TIME', '1X2 HT', 'odds_3ways_ht', 4, 1, '2025-12-14 09:25:48', '2025-12-14 09:25:48'), + (1, 'TOTALS HALF TIME', 'OU HT', 'odds_totals_ht', 4, 1, '2025-12-14 09:32:38', '2025-12-14 09:32:38'), + (1, 'GOAL NO GOAL', 'GGNG', 'odds_ggng', 4, 0, '2025-12-14 09:31:56', '2025-12-14 09:31:56'), + (1, 'DOUBLE CHANCE', 'DC', 'odds_dc', 4, 1, '2025-12-14 09:31:22', '2025-12-14 09:32:55'), + (1, 'TO QUALIFY', 'TQ', 'odds_tq', 4, 0, '2025-12-14 09:32:19', '2025-12-14 09:32:19'), + (1, 'DRAW NO BET', 'DNB', 'odds_dnb', 4, 0, '2025-12-14 09:31:42', '2025-12-14 09:31:42'), + + (2, '1X2', '1X2', 'odds_3ways', 4, 1, '2025-12-14 09:41:34', '2025-12-14 09:41:34'), + (2, 'MONEY LINE', 'ML', 'odds_2ways', 4, 0, '2025-12-14 09:41:21', '2025-12-14 09:41:21'), + (2, 'POINTS', 'HC', 'odds_points', 4, 1, '2025-12-14 09:41:56', '2025-12-14 09:41:56'), + (2, 'TOTALS', 'OU', 'odds_totals', 4, 1, '2025-12-14 09:42:13', '2025-12-14 09:42:13'), + (2, 'POINTS FIRST QUARTER', 'HC Q1', 'odds_points_q1', 4, 1, '2025-12-14 09:41:56', '2025-12-14 09:41:56'), + (2, 'TOTALS FIRST QUARTER', 'OU Q1', 'odds_totals_q1', 4, 1, '2025-12-14 09:42:13', '2025-12-14 09:42:13'), + + (3, 'MONEY LINE', 'ML', 'odds_2ways', 4, 0, '2025-12-14 09:37:32', '2025-12-14 09:37:32'), + (3, 'POINTS', 'HC', 'odds_points', 4, 1, '2025-12-14 09:38:05', '2025-12-14 09:38:05'), + (3, 'TOTALS', 'OU', 'odds_totals', 4, 1, '2025-12-14 09:38:44', '2025-12-14 09:38:44'), + (3, 'POINTS FIRST QUARTER', 'HC Q1', 'odds_points_q1', 4, 1, '2025-12-14 09:38:26', '2025-12-14 09:39:54'), + (3, 'TOTALS FIRST QUARTER', 'OU Q1', 'odds_totals_q1', 4, 1, '2025-12-14 09:39:12', '2025-12-14 09:39:59'), + (3, 'POINTS HALF TIME', 'HC HT', 'odds_points_ht', 4, 1, '2025-12-14 09:38:26', '2025-12-14 09:39:54'), + (3, 'TOTALS HALF TIME', 'OU HT', 'odds_totals_ht', 4, 1, '2025-12-14 09:39:12', '2025-12-14 09:39:59'), + + (5, 'MONEY LINE', 'ML', 'odds_2ways', 4, 0, '2025-12-14 09:43:52', '2025-12-14 09:43:52'), + (5, 'MONEY LINE SET 1', 'ML S1', 'odds_2ways_s1', 4, 0, '2025-12-14 09:44:13', '2025-12-14 09:44:13'), + (5, 'TOTALS', 'OU', 'odds_totals', 4, 1, '2025-12-14 09:44:26', '2025-12-14 09:44:26'), + (5, 'POINTS', 'HC', 'odds_points', 4, 1, '2025-12-14 09:44:26', '2025-12-14 09:44:26'); "; DB::unprepared($sql);