wip matches

This commit is contained in:
salam committed 2025-08-27 12:51:03 +02:00
1 parent adb15e701b
commit 7116d3c576
33 files changed
+379 -176

No files matched your search

+6 -4
View File
@@ -1,8 +1,10 @@
APP_NAME=Laravel
APP_NAME=NuhOdds
APP_ENV=local
APP_KEY=
APP_KEY=base64:xhigDJOEk2dBUc3pfYXm7yo8a14PTtVCIU4PAt+F2dM=
APP_DEBUG=true
APP_URL=http://localhost
APP_URL=http://nuhodds_fi4.test
BETSAPI_TOKEN="36152-aeTRNnZxSPUwGe"
TXODDS_TOKEN="Dy59vpRC"
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
@@ -25,7 +27,7 @@ DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=nuhodds_fi4
DB_USERNAME=root
DB_PASSWORD=
DB_PASSWORD=salam
SESSION_DRIVER=database
SESSION_LIFETIME=120
@@ -1,17 +1,34 @@
<?php
namespace App\Utilities;
namespace App\Console\Commands;
use App\Utilities\Notice;
class Curl
{
public static function load($url, $debug = 0)
public static $storage_file;
public static function load($url)
{
BetsapiCounter::count($debug);
self::$storage_file = app_path().'/Utilities/TestFileStorage/latest.json';
$debug = NuhBash::$options['debug'] ?? 0;
$save_to_storage = NuhBash::$options['s'] ?? 0;
$load_form_storage = NuhBash::$options['l'] ?? 0;
if ($debug) {
Notice::note($url, 'g');
}
if ($load_form_storage) {
$file = file_get_contents(self::$storage_file);
if ($debug) {
Notice::note('data from storage', 'b');
}
return json_decode($file, true);
}
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
@@ -24,6 +41,11 @@ class Curl
}
curl_close($ch);
if ($save_to_storage) {
Notice::note('data saved to local storage', 'b');
file_put_contents(self::$storage_file, $data);
}
return json_decode($data, true);
}
-36
View File
@@ -1,36 +0,0 @@
<?php
namespace App\Console\Commands\Grapper;
use App\Utilities\Notice;
class Helper
{
/**
* Create a new class instance.
*/
public static function get_auth_string()
{
if (Grapper::$options['provider_id'] == 1) {
// txodds soccer
Grapper::$auth = 'ident=betaid1&passwd=Dy59vpRC';
Grapper::$domain = 'https://xml2.txodds.com/';
} elseif (Grapper::$options['provider_id'] == 3) {
// txodds others
Grapper::$auth = 'ident=betaid2&passwd=Dy59vpRC';
Grapper::$domain = 'https://xml2.txodds.com/';
} else {
Notice::note('error txodds provider', 'r', 1);
}
}
public static function margin($arr)
{
$r = 0;
foreach ($arr as $key => $value) {
$r += 100 / $value;
}
return round($r, 3);
}
}
@@ -0,0 +1,25 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds;
use App\Models\Element;
class TxElement
{
public static function find($element, $sport_id)
{
// dd($element);
$txodds_id = array_column($element, 'id');
$element = Element::firstOrCreate([
'name' => (string) $element['@text'],
'sport_id' => $sport_id,
'txodds_id' => (int) $txodds_id[0],
]);
return $element->id;
}
}
@@ -0,0 +1,32 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds;
use App\Console\Commands\NuhBash;
use App\Models\Country;
use App\Models\Liga;
class TxLigas
{
public static function find($group)
{
$debug = NuhBash::$options['debug'] ?? 0;
$cgid = array_column($group, 'cgid');
$cnid = array_column($group, 'cnid');
$spid = array_column($group, 'spid');
$cname = array_column($group, 'cname');
$country_id = Country::where('txid', $cnid)->value('id');
$liga = Liga::firstOrCreate([
'name' => (string) $cname[0],
'sport_id' => (int) $spid[0],
'country_id' => $country_id,
'txodds_id' => (int) $cgid[0],
]);
return $liga->id;
}
}
@@ -0,0 +1,45 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds;
use App\Console\Commands\Curl;
use App\Console\Commands\NuhBash;
use App\Models\Event;
class FixturesSoccer
{
public static function call()
{
$debug = NuhBash::$options['debug'] ?? 0;
for ($i = 0; $i < 30; $i++) {
$str1 = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') + $i, date('Y')));
$str2 = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') + 1 + $i, date('Y')));
$url = 'https://xml2.txodds.com/feed/result/xml.php?ident=betaid1&passwd='.config('nuh.txodds_token')."&date=$str1,$str2&json=2";
$data = Curl::load($url, $debug);
foreach ($data['match'] as $row) {
$txodds_id = array_column($row, 'id');
$spid = array_column($row['group'], 'spid');
$liga_id = TxLigas::find($row['group']);
$home_id = TxElement::find($row['hteam'], 1);
$away_id = TxElement::find($row['ateam'], 1);
$event = Event::firstOrCreate([
'starttime' => date('Y-m-d H:i:s', strtotime($row['time'])),
'sport_id' => (int) $spid[0],
'provider_id' => 1,
'txodds_id' => (int) $txodds_id,
'liga_id' => $liga_id,
'home_id' => $home_id,
'away_id' => $away_id,
]);
dd($event);
}
}
}
}
@@ -1,34 +1,32 @@
<?php
namespace App\Console\Commands\Grapper\TxOdds;
namespace App\Console\Commands\Grapper;
use App\Console\Commands\Grapper\Grapper;
use App\Console\Commands\Grapper\TxOdds\FixturesSoccer;
use App\Console\Commands\NuhBash;
class TxOdds
class TxSwitch
{
/**
* https://docs.guzzlephp.org/en/latest/
*/
public static function switch()
{
switch (Grapper::$options['option_id']) {
switch (NuhBash::$options['id']) {
case 1:
// Leages
FixturesSoccer::call();
break;
case 2:
Events::grap();
break;
case 3:
// Flags
break;
case 4:
Odds::grap();
break;
case 5:
Countries::grap();
break;
default:
Note::notice('Provider not defined', 'r', 1);
Note::notice('wrong process id for txodds', 'r', 1);
break;
}
}
+26 -16
View File
@@ -2,7 +2,7 @@
namespace App\Console\Commands;
use App\Console\Commands\Grapper\TxOdds\TxOdds;
use App\Console\Commands\Grapper\TxSwitch;
use App\Models\Supervisor;
use App\Utilities\Notice;
use App\Utilities\Supervisorctl;
@@ -26,7 +26,7 @@ class NuhBash extends Command
public static $auth = '';
protected $signature = 'nuh {process=help} {eventid=0} {--d} {--f} {--a} {--p} {--w}';
protected $signature = 'nuh {process=help} {eventid=0} {--d} {--f} {--a} {--p} {--w} {--s} {--l}';
protected $description = 'NuhBash';
@@ -38,11 +38,12 @@ class NuhBash extends Command
self::$options['event_id'] = $this->argument('eventid');
if ($this->argument('process') == 'help') {
$txt = 'List of parameters'.PHP_EOL;
$txt = PHP_EOL;
$txt .= 'List of parameters'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL;
$txt .= 'process [id] (required)'.PHP_EOL;
$txt .= 'eventid [id] (optional)'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL.PHP_EOL;
$txt .= 'List of options'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL;
$txt .= '--d debug'.PHP_EOL;
@@ -50,7 +51,9 @@ class NuhBash extends Command
$txt .= '--a reload all'.PHP_EOL;
$txt .= '--w reload one week'.PHP_EOL;
$txt .= '--p print odds'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL;
$txt .= '--s store grapped file '.PHP_EOL;
$txt .= '--l load latest grapped file '.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL.PHP_EOL;
$txt .= 'List of supervisors'.PHP_EOL;
$txt .= '----------------------------------------------'.PHP_EOL;
$tmp = Supervisor::all();
@@ -62,18 +65,25 @@ class NuhBash extends Command
Supervisorctl::start(self::$options);
Helper::get_auth_string();
switch (self::$options['type']) {
case 'Grapper':
switch (self::$options['provider_id']) {
case 1:
TxSwitch::switch();
case 2:
// betsapi
break;
case 3:
// direct
break;
default:
Note::notice('Provider not defined', 'r', 1);
break;
}
break;
switch (self::$options['provider_id']) {
case 1:
case 2:
TxOdds::switch();
break;
case 3:
// betsapi
break;
default:
Note::notice('Provider not defined', 'r', 1);
case 'Comparatore':
// code...
break;
}
@@ -5,6 +5,7 @@ namespace App\Filament\Clusters\Maintenance\Resources\Events\Tables;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
@@ -14,45 +15,47 @@ class EventsTable
{
return $table
->columns([
TextColumn::make('time')
->dateTime()
->sortable(),
TextColumn::make('spid')
->numeric()
->sortable(),
TextColumn::make('prid')
->numeric()
->sortable(),
TextColumn::make('txid')
->numeric()
->sortable(),
TextColumn::make('brid')
->numeric()
->sortable(),
TextColumn::make('baid')
->numeric()
->sortable(),
TextColumn::make('cnid')
->numeric()
->sortable(),
TextColumn::make('grid')
->numeric()
->sortable(),
TextColumn::make('cgid')
->numeric()
->sortable(),
TextColumn::make('hoid')
->numeric()
->sortable(),
TextColumn::make('awid')
->numeric()
->sortable(),
TextColumn::make('liga')
->searchable(),
TextColumn::make('home')
->searchable(),
TextColumn::make('away')
->searchable(),
IconColumn::make('sport_id')
->label('')
->icon(function ($record): string {
return $record->sport->icon;
}),
TextColumn::make('starttime')->dateTime('M j, Y H:i')->sortable(),
TextColumn::make('liga.name')->searchable(),
TextColumn::make('home.name')->searchable(),
TextColumn::make('away.name')->searchable(),
// TextColumn::make('prid')
// ->numeric()
// ->sortable(),
// TextColumn::make('txid')
// ->numeric()
// ->sortable(),
// TextColumn::make('brid')
// ->numeric()
// ->sortable(),
// TextColumn::make('baid')
// ->numeric()
// ->sortable(),
// TextColumn::make('cnid')
// ->numeric()
// ->sortable(),
// TextColumn::make('grid')
// ->numeric()
// ->sortable(),
// TextColumn::make('cgid')
// ->numeric()
// ->sortable(),
// TextColumn::make('hoid')
// ->numeric()
// ->sortable(),
// TextColumn::make('awid')
// ->numeric()
// ->sortable(),
// TextColumn::make('liga')
// ->searchable(),
// TextColumn::make('away')
// ->searchable(),
TextColumn::make('created_at')
->dateTime()
->sortable()
@@ -8,6 +8,7 @@ use App\Models\Sport;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Enums\IconSize;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\ToggleColumn;
@@ -43,21 +44,16 @@ class SportResource extends Resource
->columns([
IconColumn::make('icon')
->label('')
->size(IconSize::TwoExtraLarge)
->icon(function ($record): string {
return $record->icon;
})->color(function ($record): string {
if ($record->is_active == 1) {
return 'primary';
} else {
return 'gray';
}
}),
TextColumn::make('name'),
TextColumn::make('bapi'),
TextColumn::make('bwin'),
TextColumn::make('b365'),
TextColumn::make('logi'),
TextColumn::make('magl'),
TextColumn::make('bapi')->alignCenter()->label('Betsapi'),
TextColumn::make('bwin')->alignCenter()->label('Bwin'),
TextColumn::make('b365')->alignCenter()->label('Bet365'),
TextColumn::make('logi')->alignCenter()->label('Logifuture'),
TextColumn::make('magl')->alignCenter()->label('Magloo'),
ToggleColumn::make('is_active'),
])
->filters([
@@ -25,7 +25,7 @@ class SupervisorForm
'Grapper' => 'Grapper',
'Comparatore' => 'Comparatore',
])
->default('grapper')
->default('Grapper')
->selectablePlaceholder(false),
Select::make('provider_id')
->relationship('provider', 'name')
@@ -18,8 +18,7 @@ class SupervisorsTable
return $table
->columns([
TextColumn::make('id')->badge(),
TextColumn::make('name')
->searchable(),
TextColumn::make('name')->searchable(),
TextColumn::make('type')->badge(),
TextColumn::make('provider.name')
->badge()->color(fn (string $state): string => match ($state) {
@@ -40,7 +39,6 @@ class SupervisorsTable
TextColumn::make('runtime'),
TextColumn::make('lastcall'),
IconColumn::make('is_cron')->boolean()->label('Cron')->falseColor('gray'),
ToggleColumn::make('is_active')->label('On/Off'),
TextColumn::make('created_at')
->dateTime()
->sortable()
@@ -49,6 +47,7 @@ class SupervisorsTable
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
ToggleColumn::make('is_active')->label('On/Off'),
])
->filters([
//
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Element extends Model
{
protected $fillable = [
'name',
'sport_id',
'txodds_id',
'betsapi_id',
'mag_id',
'log_id',
];
}
+35 -1
View File
@@ -6,5 +6,39 @@ use Illuminate\Database\Eloquent\Model;
class Event extends Model
{
//
protected $fillable = [
'starttime',
'sport_id',
'provider_id',
'txodds_id',
'betaid_id',
'betradar_id',
'magnig_id',
'magken_id',
'lognig_id',
'logcol_id',
'liga_id',
'home_id',
'away_id',
];
public function home()
{
return $this->belongsTo(Element::class);
}
public function away()
{
return $this->belongsTo(Element::class);
}
public function sport()
{
return $this->belongsTo(Sport::class);
}
public function liga()
{
return $this->belongsTo(Liga::class);
}
}
+15
View File
@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Liga extends Model
{
protected $fillable = [
'name',
'sport_id',
'country_id',
'txodds_id',
];
}
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace App\Utilities;
class Margin
{
public static function margin($arr)
{
if (! is_array($arr)) {
return false;
}
$r = 0;
foreach ($arr as $key => $value) {
$r += 100 / $value;
}
return round($r, 3);
}
}
+13 -13
View File
@@ -16,32 +16,32 @@ class Supervisorctl
{
$debug = $options['d'] ?? 0;
// sleep 1 sec to avoid error in supervisor
sleep(1);
// sleep for 0,5 seconds
usleep(500000);
self::$starttime = microtime(true);
self::$code = $options['code'];
self::$code = $options['supervisor_id'];
$supervisor = Supervisor::where('code', self::$code)->get()->first();
$supervisor = Supervisor::find(self::$code);
// if process can be called only from bash
if ($supervisor) {
$options['sport_id'] = $supervisor->sport_id;
$options['customer_id'] = $supervisor->customer_id;
$options['limit'] = $supervisor->limit;
if ($debug) {
Notice::note('supervisor start '.self::$code, 'g');
}
if ($supervisor->sleep > 0) {
$options = array_merge($options, $supervisor->toArray());
if ($options['sleep'] > 0) {
if (! $debug) {
sleep($supervisor->sleep);
sleep($options['sleep']);
} else {
Notice::note('without debug process sleeps for '.$options['sleep'].'sec', 'g');
}
}
} else {
Notice::note('unknown supervisor: '.$options['code'], 'r', 1);
Notice::note('unknown supervisor: '.self::$code, 'r', 1);
}
}
@@ -49,7 +49,7 @@ class Supervisorctl
{
$processend = microtime(true);
$runtime = round(($processend - self::$starttime) / 60, 3);
Supervisor::where('code', self::$code)->update(['runtime' => $runtime, 'events' => self::$events]);
Supervisor::where('id', self::$code)->update(['runtime' => $runtime, 'events' => self::$events]);
if ($options['d']) {
Notice::note('spervisor time: '.$runtime.' min', 'g');
}
@@ -0,0 +1 @@
{"@attributes":{"time":"2025-08-27T09:16:03+00:00","timestamp":"1756286163"},"match":[{"@attributes":{"id":"14206418","xsid":"0","gsmid":"0","last_updated":"2025-08-27T04:01:22+00:00"},"time":"2025-08-27T00:00:00+00:00","group":{"@attributes":{"id":"176385","cgid":"613","spid":"1","cnid":"389","mgid":"1100","cname":"Copa Colombia"},"@text":"FBCOL Copa Colombia-25"},"hteam":{"@attributes":{"id":"7300"},"@text":"Deportivo Pereira"},"ateam":{"@attributes":{"id":"1748701"},"@text":"Real Cundinamarca"},"results":{"status":{"@attributes":{"last_updated":"2025-08-27T04:01:22+00:00","minute":"-1"},"@text":"Fin"},"result":[{"@attributes":{"id":"1","name":"CURRENT","value":"4-3"}},{"@attributes":{"id":"2","name":"FT","value":"4-3"}},{"@attributes":{"id":"3","name":"HT","value":"2-2"}}],"periods":{"period":[{"@attributes":{"id":"1","name":"1HF"},"detail":{"@attributes":{"name":"SCORE","value":"2-2"}}},{"@attributes":{"id":"2","name":"2HF"},"detail":{"@attributes":{"name":"SCORE","value":"2-1"}}},{"@attributes":{"id":"3","name":"ET"},"detail":{"@attributes":{"name":"SCORE","value":""}}},{"@attributes":{"id":"4","name":"PEN"},"detail":{"@attributes":{"name":"SCORE","value":""}}}]}}},{"@attributes":{"id":"14219467","xsid":"0","gsmid":"0","last_updated":"2025-08-27T04:01:19+00:00"},"time":"2025-08-27T00:00:00+00:00","group":{"@attributes":{"id":"174073","cgid":"1459","spid":"1","cnid":"409","mgid":"1009","cname":"CBF Brasileiro U20"},"@text":"FBBRA CBF Brasileiro U20-25"},"hteam":{"@attributes":{"id":"67272"},"@text":"Palmeiras SP U20"},"ateam":{"@attributes":{"id":"91468"},"@text":"RB Bragantino U20"},"results":{"status":{"@attributes":{"last_updated":"2025-08-27T04:01:17+00:00","minute":"-1"},"@text":"Fin"},"result":{"@attributes":{"id":"1","name":"CURRENT","value":""}}}},{"@attributes":{"id":"14221015","xsid":"0","gsmid":"0","last_updated":"2025-08-27T04:01:19+00:00"},"time":"2025-08-27T00:00:00+00:00","group":{"@attributes":{"id":"178055","cgid":"1150","spid":"1","cnid":"477","mgid":"1183","cname":"Copa Costa Rica"},"@text":"FBCRI Copa Costa Rica-25"},"hteam":{"@attributes":{"id":"9458"},"@text":"Carmelita"},"ateam":{"@attributes":{"id":"1971266"},"@text":"Inter San Carlos"},"results":{"status":{"@attributes":{"last_updated":"2025-08-27T04:01:19+00:00","minute":"-1"},"@text":"Fin"},"result":[{"@attributes":{"id":"1","name":"CURRENT","value":"2-0"}},{"@attributes":{"id":"2","name":"FT","value":"2-0"}},{"@attributes":{"id":"3","name":"HT","value":"1-0"}}],"periods":{"period":[{"@attributes":{"id":"1","name":"1HF"},"detail":{"@attributes":{"name":"SCORE","value":"1-0"}}},{"@attributes":{"id":"2","name":"2HF"},"detail":{"@attributes":{"name":"SCORE","value":"1-0"}}},{"@attributes":{"id":"3","name":"ET"},"detail":{"@attributes":{"name":"SCORE","value":""}}},{"@attributes":{"id":"4","name":"PEN"},"detail":{"@attributes":{"name":"SCORE","value":""}}}]}}},{"@attributes":{"id":"14228363","xsid":"0","gsmid":"0","last_updated":"2025-08-27T03:00:26+00:00"},"time":"2025-08-27T00:00:00+00:00","group":{"@attributes":{"id":"178551","cgid":"704","spid":"1","cnid":"528","mgid":"1189","cname":"CONCACAF Caribbean Cup"},"@text":"FBNACUP CONCACAF Caribbean Cup-25"},"hteam":{"@attributes":{"id":"59552"},"@text":"Weymouth Wales"},"ateam":{"@attributes":{"id":"241190"},"@text":"Cibao"},"results":{"status":{"@attributes":{"last_updated":"2025-08-27T03:00:26+00:00","minute":"-1"},"@text":"Sched"},"result":[{"@attributes":{"id":"1","name":"CURRENT","value":"1-2"}},{"@attributes":{"id":"2","name":"FT","value":"1-2"}},{"@attributes":{"id":"3","name":"HT","value":"0-2"}}],"periods":{"period":[{"@attributes":{"id":"1","name":"1HF"},"detail":{"@attributes":{"name":"SCORE","value":"0-2"}}},{"@attributes":{"id":"2","name":"2HF"},"detail":{"@attributes":{"name":"SCORE","value":"1-0"}}},{"@attributes":{"id":"3","name":"ET"},"detail":{"@attributes":{"name":"SCORE","value":""}}},{"@attributes":{"id":"4","name":"PEN"},"detail":{"@attributes":{"name":"SCORE","value":""}}}]}}},{"@attributes":{"id":"14236868","xsid":"0","gsmid":"0","last_updated":"2025-08-27T03:00:26+00:00"},"time":"2025-08-27T00:00:00+00:00","group":{"@attributes":{"id":"174829","cgid":"1857","spid":"1","cnid":"409","mgid":"1357","cname":"Brasileiro Feminino A2"},"@text":"WFBBRA Brasileiro Feminino A2-25"},"hteam":{"@attributes":{"id":"188666"},"@text":"Botafogo FR"},"ateam":{"@attributes":{"id":"52555"},"@text":"Santos"},"results":{"status":{"@attributes":{"last_updated":"2025-08-27T03:00:26+00:00","minute":"-1"},"@text":"Sched"},"result":[{"@attributes":{"id":"1","name":"CURRENT","value":"0-1"}},{"@attributes":{"id":"2","name":"FT","value":"0-1"}},{"@attributes":{"id":"3","name":"HT","value":"0-0"}}],"periods":{"period":[{"@attributes":{"id":"1","name":"1HF"},"detail":{"@attributes":{"name":"SCORE","value":"0-0"}}},{"@attributes":{"id":"2","name":"2HF"},"detail":{"@attributes":{"name":"SCORE","value":"0-1"}}},{"@attributes":{"id":"3","name":"ET"},"detail":{"@attributes":{"name":"SCORE","vaLine truncated
+1
View File
@@ -73,6 +73,7 @@ return [
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'timezone' => '+01:00',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
+6
View File
@@ -0,0 +1,6 @@
<?php
return [
'betsapi_token' => env('BETSAPI_TOKEN', 'var missing in env'),
'txodds_token' => env('TXODDS_TOKEN', 'var missing in env'),
];
@@ -13,26 +13,22 @@ return new class extends Migration
{
Schema::create('events', function (Blueprint $table) {
$table->id();
$table->timestamp('starttime')->nullable();
$table->integer('sport_id');
$table->integer('provider_id')->default(0);
$table->integer('txodds_id')->default(0);
$table->integer('betaid_id')->default(0);
$table->integer('betradar_id')->default(0);
$table->integer('country_id')->default(0);
$table->integer('group_id')->default(0);
$table->integer('home_id')->default(0);
$table->integer('away_id')->default(0);
$table->dateTime('starttime')->nullable();
$table->integer('sport_id')->index();
$table->integer('provider_id')->default(0)->index();
$table->integer('txodds_id')->default(0)->index();
$table->integer('betaid_id')->default(0)->index();
$table->integer('betradar_id')->default(0)->index();
$table->integer('magnig_id')->default(0)->index();
$table->integer('magken_id')->default(0)->index();
$table->integer('lognig_id')->default(0)->index();
$table->integer('logcol_id')->default(0)->index();
$table->integer('liga_id')->default(0)->index();
$table->integer('home_id')->default(0)->index();
$table->integer('away_id')->default(0)->index();
$table->timestamps();
$table->index(['sport_id']);
$table->index(['provider_id']);
$table->index(['txodds_id']);
$table->index(['betaid_id']);
$table->index(['betradar_id']);
$table->index(['country_id']);
$table->index(['group_id']);
$table->index(['home_id']);
$table->index(['away_id']);
});
}
@@ -11,14 +11,15 @@ return new class extends Migration
*/
public function up(): void
{
Schema::create('groups', function (Blueprint $table) {
Schema::create('elements', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->integer('sport_id');
$table->integer('country_id')->default(0);
$table->integer('sport_id')->index();
$table->integer('txodds_id')->default(0)->index();
$table->integer('betsapi_id')->default(0)->index();
$table->integer('mag_id')->default(0)->index();
$table->integer('log_id')->default(0)->index();
$table->timestamps();
$table->index(['sport_id']);
$table->index(['country_id']);
});
}
@@ -27,6 +28,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::dropIfExists('groups');
Schema::dropIfExists('elements');
}
};
@@ -11,14 +11,16 @@ return new class extends Migration
*/
public function up(): void
{
Schema::create('group_filters', function (Blueprint $table) {
Schema::create('ligas', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->integer('sport_id');
$table->integer('provider_id')->default(0);
$table->integer('sport_id')->index();
$table->integer('country_id')->default(0)->index();
$table->integer('txodds_id')->default(0)->index();
$table->integer('betsapi_id')->default(0)->index();
$table->integer('mag_id')->default(0)->index();
$table->integer('log_id')->default(0)->index();
$table->timestamps();
$table->index(['sport_id']);
$table->index(['provider_id']);
});
}
@@ -27,6 +29,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::dropIfExists('group_filters');
Schema::dropIfExists('ligas');
}
};
@@ -17,7 +17,7 @@ return new class extends Migration
$table->integer('sport_id')->default(0);
$table->integer('matchpart_id')->default(0);
$table->integer('bookmaker_id')->default(0);
$table->integer('provider_id')->default(0);
$table->integer('offer_id')->default(0);
$table->decimal('home', 7, 3)->default(0);
$table->decimal('draw', 7, 3)->default(0);
$table->decimal('away', 7, 3)->default(0);
@@ -17,7 +17,7 @@ return new class extends Migration
$table->integer('sport_id')->default(0);
$table->integer('matchpart_id')->default(0);
$table->integer('bookmaker_id')->default(0);
$table->integer('provider_id')->default(0);
$table->integer('offer_id')->default(0);
$table->decimal('home', 7, 3)->default(0);
$table->decimal('away', 7, 3)->default(0);
$table->decimal('margin', 7, 3)->default(0);
@@ -17,7 +17,7 @@ return new class extends Migration
$table->integer('sport_id')->default(0);
$table->integer('matchpart_id')->default(0);
$table->integer('bookmaker_id')->default(0);
$table->integer('provider_id')->default(0);
$table->integer('offer_id')->default(0);
$table->decimal('dc1x', 7, 3)->default(0);
$table->decimal('dc12', 7, 3)->default(0);
$table->decimal('dc2x', 7, 3)->default(0);
@@ -17,7 +17,7 @@ return new class extends Migration
$table->integer('sport_id')->default(0);
$table->integer('matchpart_id')->default(0);
$table->integer('bookmaker_id')->default(0);
$table->integer('provider_id')->default(0);
$table->integer('offer_id')->default(0);
$table->decimal('dnb1', 7, 3)->default(0);
$table->decimal('dnb2', 7, 3)->default(0);
$table->decimal('margin', 7, 3)->default(0);
@@ -17,7 +17,7 @@ return new class extends Migration
$table->integer('sport_id')->default(0);
$table->integer('matchpart_id')->default(0);
$table->integer('bookmaker_id')->default(0);
$table->integer('provider_id')->default(0);
$table->integer('offer_id')->default(0);
$table->decimal('gg', 7, 3)->default(0);
$table->decimal('ng', 7, 3)->default(0);
$table->decimal('margin', 7, 3)->default(0);
@@ -17,7 +17,7 @@ return new class extends Migration
$table->integer('sport_id')->default(0);
$table->integer('matchpart_id')->default(0);
$table->integer('bookmaker_id')->default(0);
$table->integer('provider_id')->default(0);
$table->integer('offer_id')->default(0);
$table->decimal('htq', 7, 3)->default(0);
$table->decimal('atq', 7, 3)->default(0);
$table->decimal('margin', 7, 3)->default(0);
@@ -17,7 +17,7 @@ return new class extends Migration
$table->integer('sport_id')->default(0);
$table->integer('matchpart_id')->default(0);
$table->integer('bookmaker_id')->default(0);
$table->integer('provider_id')->default(0);
$table->integer('offer_id')->default(0);
$table->decimal('home', 7, 3)->default(0);
$table->decimal('away', 7, 3)->default(0);
$table->decimal('handicap', 7, 3)->default(0);
@@ -17,7 +17,7 @@ return new class extends Migration
$table->integer('sport_id')->default(0);
$table->integer('matchpart_id')->default(0);
$table->integer('bookmaker_id')->default(0);
$table->integer('provider_id')->default(0);
$table->integer('offer_id')->default(0);
$table->decimal('over', 7, 3)->default(0);
$table->decimal('under', 7, 3)->default(0);
$table->decimal('total', 7, 3)->default(0);
+15
View File
@@ -9,6 +9,9 @@ class OtherSeeder extends Seeder
{
public function run(): void
{
/**
* Provoider
*/
$sql = "INSERT INTO `providers` (`id`, `name`)
VALUES
('1', 'TxOdds'),
@@ -17,10 +20,22 @@ class OtherSeeder extends Seeder
";
DB::unprepared($sql);
/**
* Clients
*/
$sql = "INSERT INTO `clients` (`id`, `name`, `homepage`, `bookmaker`, `sport`, `created_at`, `updated_at`)
VALUES
('1', 'Magloo', NULL, '[\"20\",\"24\"]', '[\"1\",\"3\"]', '2025-08-24 05:56:41', '2025-08-24 05:56:41'),
('2', 'Logifuture', NULL, '[\"26\",\"27\"]', '[\"1\",\"2\",\"3\",\"5\"]', '2025-08-24 05:57:01', '2025-08-24 05:57:01');";
DB::unprepared($sql);
/**
* Supervisor
*/
$sql = "INSERT INTO `supervisors` (`id`, `name`, `type`, `provider_id`, `sport_id`, `bookmaker_id`, `sleep`, `limit`, `runtime`, `events`, `lastcall`, `is_cron`, `is_active`, `created_at`, `updated_at`)
VALUES
('1', 'Fixtures Soccer', 'Grapper', '1', '1', NULL, '10', '0', NULL, '0', '0', '1', '0', '2025-08-27 07:39:55', '2025-08-27 07:39:55');";
DB::unprepared($sql);
}
}