default values service

This commit is contained in:
salam committed 2026-01-20 06:00:48 +01:00
1 parent 24dbbd7fea
commit fe7fc0accf
6 files changed
+115 -41

No files matched your search

+4 -12
View File
@@ -5,7 +5,6 @@ namespace App\Actions;
use App\Models\MultilineClient;
use App\Models\MultilineSetting;
use Filament\Notifications\Notification;
use Illuminate\Support\Facades\DB;
class MultilineGenerator
{
@@ -25,17 +24,10 @@ class MultilineGenerator
for ($i = 1; $i <= 4; $i++) {
$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,
]);
MultilineClient::updateOrInsert(
['client_id' => $client_id, 'sport_id' => $sport_id, 'multiline_setting_id' => $multiline->id, 'position' => $i],
['bookmaker_id' => $bookmaker[$i], 'sort' => $i, 'disabled' => 0]
);
}
}
@@ -5,6 +5,7 @@ namespace App\Console\Commands\Services;
use App\Console\Commands\Nuh;
use App\Console\Commands\Services\Tasks\CallTxoddsMarkets;
use App\Console\Commands\Services\Tasks\DBMapper;
use App\Console\Commands\Services\Tasks\GenerateDefaultSetting;
class Services
{
@@ -17,6 +18,10 @@ class Services
case 'DB Mapper':
DBMapper::run();
break;
case 'Generate Default Setting':
GenerateDefaultSetting::run();
break;
}
}
}
@@ -0,0 +1,75 @@
<?php
namespace App\Console\Commands\Services\Tasks;
use App\Console\Commands\Nuh;
use App\Models\BettypeUser;
use App\Models\Client;
use App\Models\MultilineClient;
use App\Models\MultilineSetting;
use App\Models\Sport;
use App\Models\User;
use App\Utilities\Notice;
class GenerateDefaultSetting
{
public static function run()
{
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('GENERATE DEFAULT SETTING', 'b');
}
if ($debug) {
Notice::note('1) multiline bookmaker slots for client', 'p');
}
$sports = Sport::where('is_active', 1)->get();
$bookmaker = [0, 6, 30, 649, 117];
$clients = Client::get();
foreach ($clients as $client) {
foreach ($sports as $sport) {
$multilines = MultilineSetting::where('sport_id', $sport->id)->get();
foreach ($multilines as $multiline) {
for ($slot = 1; $slot <= 4; $slot++) {
MultilineClient::updateOrInsert(
['client_id' => $client->id, 'sport_id' => $client->id, 'multiline_setting_id' => $multiline->id, 'position' => $slot],
['bookmaker_id' => $bookmaker[$slot], 'sort' => $slot, 'disabled' => 0]
);
}
}
}
}
if ($debug) {
Notice::note('2) generator bettypes im comparatore for users', 'p');
}
$users = User::get();
foreach ($users as $user) {
$multilines = MultilineSetting::orderBy('sport_id')->pluck('sport_id', 'id');
foreach ($multilines as $multiline_setting_id => $sport_id) {
$is_active = in_array($multiline_setting_id, [1, 2, 9, 10, 16, 17, 22, 23]) ? 1 : 0;
BettypeUser::firstOrCreate(
['sport_id' => $sport_id, 'user_id' => $user->id, 'multiline_setting_id' => $multiline_setting_id],
['is_active' => $is_active]
);
}
}
}
}
@@ -75,6 +75,7 @@ class SupervisorsTable
return [
'Txodds Markets' => 'Txodds Markets',
'DB Mapper' => 'DB Mapper',
'Generate Default Setting' => 'Generate Default Setting',
];
case 9:
case 10:
Generated
+28 -28
View File
@@ -220,20 +220,20 @@
},
{
"name": "bezhansalleh/filament-plugin-essentials",
"version": "1.0.1",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/bezhanSalleh/filament-plugin-essentials.git",
"reference": "c6a9df98b798edbb1857b899169dc8125a59b4e1"
"reference": "3bfdb276a8993ccd5acd9d6b43fd4763cf221d3a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bezhanSalleh/filament-plugin-essentials/zipball/c6a9df98b798edbb1857b899169dc8125a59b4e1",
"reference": "c6a9df98b798edbb1857b899169dc8125a59b4e1",
"url": "https://api.github.com/repos/bezhanSalleh/filament-plugin-essentials/zipball/3bfdb276a8993ccd5acd9d6b43fd4763cf221d3a",
"reference": "3bfdb276a8993ccd5acd9d6b43fd4763cf221d3a",
"shasum": ""
},
"require": {
"filament/filament": "^4.0",
"filament/filament": "^4.0|^5.0",
"illuminate/contracts": "^11.28|^12.0",
"php": "^8.2",
"spatie/laravel-package-tools": "^1.9"
@@ -286,7 +286,7 @@
],
"support": {
"issues": "https://github.com/bezhanSalleh/filament-plugin-essentials/issues",
"source": "https://github.com/bezhanSalleh/filament-plugin-essentials/tree/1.0.1"
"source": "https://github.com/bezhanSalleh/filament-plugin-essentials/tree/1.1.0"
},
"funding": [
{
@@ -294,25 +294,25 @@
"type": "github"
}
],
"time": "2025-11-30T00:09:48+00:00"
"time": "2026-01-19T19:23:25+00:00"
},
{
"name": "bezhansalleh/filament-shield",
"version": "4.0.4",
"version": "4.1.0",
"source": {
"type": "git",
"url": "https://github.com/bezhanSalleh/filament-shield.git",
"reference": "9d67332c88d7363710dd9ca5ef077515b91e6996"
"reference": "bb5ac95b3c10f801e4c54bb289be8c055968726a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bezhanSalleh/filament-shield/zipball/9d67332c88d7363710dd9ca5ef077515b91e6996",
"reference": "9d67332c88d7363710dd9ca5ef077515b91e6996",
"url": "https://api.github.com/repos/bezhanSalleh/filament-shield/zipball/bb5ac95b3c10f801e4c54bb289be8c055968726a",
"reference": "bb5ac95b3c10f801e4c54bb289be8c055968726a",
"shasum": ""
},
"require": {
"bezhansalleh/filament-plugin-essentials": "^1.0",
"filament/filament": "^4.0",
"filament/filament": "^4.0|^5.0",
"illuminate/contracts": "^11.28|^12.0",
"illuminate/support": "^11.28|^12.0",
"php": "^8.2",
@@ -381,7 +381,7 @@
],
"support": {
"issues": "https://github.com/bezhanSalleh/filament-shield/issues",
"source": "https://github.com/bezhanSalleh/filament-shield/tree/4.0.4"
"source": "https://github.com/bezhanSalleh/filament-shield/tree/4.1.0"
},
"funding": [
{
@@ -389,7 +389,7 @@
"type": "github"
}
],
"time": "2025-12-26T09:31:27+00:00"
"time": "2026-01-19T19:28:46+00:00"
},
{
"name": "blade-ui-kit/blade-heroicons",
@@ -10971,11 +10971,11 @@
},
{
"name": "phpstan/phpstan",
"version": "2.1.33",
"version": "2.1.34",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/9e800e6bee7d5bd02784d4c6069b48032d16224f",
"reference": "9e800e6bee7d5bd02784d4c6069b48032d16224f",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/070ba754a949fcade788e16e8dc5a5935b7cf2ee",
"reference": "070ba754a949fcade788e16e8dc5a5935b7cf2ee",
"shasum": ""
},
"require": {
@@ -11020,7 +11020,7 @@
"type": "github"
}
],
"time": "2025-12-05T10:24:31+00:00"
"time": "2026-01-19T19:52:16+00:00"
},
{
"name": "phpunit/php-code-coverage",
@@ -11468,21 +11468,21 @@
},
{
"name": "rector/rector",
"version": "2.3.1",
"version": "2.3.2",
"source": {
"type": "git",
"url": "https://github.com/rectorphp/rector.git",
"reference": "9afc1bb43571b25629f353c61a9315b5ef31383a"
"reference": "07cbbe28bd60251b96b18d42e514779b0e2faa83"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/9afc1bb43571b25629f353c61a9315b5ef31383a",
"reference": "9afc1bb43571b25629f353c61a9315b5ef31383a",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/07cbbe28bd60251b96b18d42e514779b0e2faa83",
"reference": "07cbbe28bd60251b96b18d42e514779b0e2faa83",
"shasum": ""
},
"require": {
"php": "^7.4|^8.0",
"phpstan/phpstan": "^2.1.33"
"phpstan/phpstan": "^2.1.34"
},
"conflict": {
"rector/rector-doctrine": "*",
@@ -11516,7 +11516,7 @@
],
"support": {
"issues": "https://github.com/rectorphp/rector/issues",
"source": "https://github.com/rectorphp/rector/tree/2.3.1"
"source": "https://github.com/rectorphp/rector/tree/2.3.2"
},
"funding": [
{
@@ -11524,7 +11524,7 @@
"type": "github"
}
],
"time": "2026-01-13T15:13:58+00:00"
"time": "2026-01-20T01:11:51+00:00"
},
{
"name": "sebastian/cli-parser",
@@ -12814,12 +12814,12 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {},
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": "^8.3"
},
"platform-dev": [],
"plugin-api-version": "2.6.0"
"platform-dev": {},
"plugin-api-version": "2.9.0"
}
+2 -1
View File
@@ -65,7 +65,8 @@ class SupervisorSeeder extends Seeder
(49, '', 8, 5, 4, 30, 0, NULL, NULL, 30, 0, 0, 0, 0, 10, 10, '2026-01-14 17:41:11', '2026-01-14 17:41:23'),
(50, '', 8, 5, 131073, 30, 0, NULL, NULL, 30, 0, 0, 0, 0, 10, 10, '2026-01-14 17:41:16', '2026-01-14 17:41:25'),
(51, '', 9, 1, NULL, 30, 0, NULL, NULL, 30, 0, 0, 0, 0, 10, 10, '2026-01-16 12:05:14', '2026-01-16 12:05:14'),
(52, '', 10, 0, NULL, 30, 0, NULL, NULL, 30, 0, 0, 0, 0, 10, 10, '2026-01-16 12:05:14', '2026-01-16 12:05:14');
(52, '', 10, 0, NULL, 30, 0, NULL, NULL, 30, 0, 0, 0, 0, 10, 10, '2026-01-16 12:05:14', '2026-01-16 12:05:14'),
(53, 'Generate Default Setting', 7, 0, NULL, 30, 0, NULL, NULL, 30, 0, 0, 0, 0, 10, 10, '2026-01-16 12:05:14', '2026-01-16 12:05:14');
";
DB::unprepared($sql);
}