diff --git a/app/Console/Commands/Grapper/Grapper.php b/app/Console/Commands/NuhBash.php similarity index 57% rename from app/Console/Commands/Grapper/Grapper.php rename to app/Console/Commands/NuhBash.php index ed8806dc..a4118ec9 100644 --- a/app/Console/Commands/Grapper/Grapper.php +++ b/app/Console/Commands/NuhBash.php @@ -1,6 +1,6 @@ options(); - dd(self::$options); - self::$options['supervisor_id'] = $this->argument('process'); self::$options['event_id'] = $this->argument('eventid'); if ($this->argument('process') == 'help') { - $txt = PHP_EOL.'a gra process [id] eventid [id]'.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 .= 'List of options'.PHP_EOL; + $txt .= '----------------------------------------------'.PHP_EOL; $txt .= '--d debug'.PHP_EOL; $txt .= '--f force update market'.PHP_EOL; $txt .= '--a reload all'.PHP_EOL; $txt .= '--w reload one week'.PHP_EOL; - $txt .= '--p print odds'.PHP_EOL.PHP_EOL; - $txt .= 'eventid'.PHP_EOL.PHP_EOL; - $txt .= 'use "gra l" to show options'.PHP_EOL; - Notice::note($txt, 'b', 1); - } elseif ($this->argument('process') == 'l') { - $txt = 'list of grapper processes'; - $txt .= Supervisor::list('gra'); + $txt .= '--p print odds'.PHP_EOL; + $txt .= '----------------------------------------------'.PHP_EOL; + $txt .= 'List of supervisors'.PHP_EOL; + $txt .= '----------------------------------------------'.PHP_EOL; + $tmp = Supervisor::all(); + foreach ($tmp as $value) { + $txt .= $value->provider->name.' '.$value->id.' - '.$value->type.' '.$value->name.PHP_EOL; + } Notice::note($txt, 'b', 1); } diff --git a/app/Filament/Resources/Supervisors/Schemas/SupervisorForm.php b/app/Filament/Resources/Supervisors/Schemas/SupervisorForm.php index bc2388bf..9481f6bc 100644 --- a/app/Filament/Resources/Supervisors/Schemas/SupervisorForm.php +++ b/app/Filament/Resources/Supervisors/Schemas/SupervisorForm.php @@ -6,6 +6,9 @@ use App\Models\Bookmaker; use App\Models\Sport; use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; +use Filament\Forms\Components\Toggle; +use Filament\Schemas\Components\Fieldset; +use Filament\Schemas\Components\Utilities\Get; use Filament\Schemas\Schema; class SupervisorForm @@ -16,7 +19,14 @@ class SupervisorForm ->components([ TextInput::make('name') ->required() - ->default(null), + ->columnSpan(2), + Select::make('type') + ->options([ + 'Grapper' => 'Grapper', + 'Comparatore' => 'Comparatore', + ]) + ->default('grapper') + ->selectablePlaceholder(false), Select::make('provider_id') ->relationship('provider', 'name') ->required() @@ -26,15 +36,16 @@ class SupervisorForm ->nullable(), Select::make('bookmaker_id') ->options(Bookmaker::query()->where('is_active', 1)->pluck('name', 'id')) - ->nullable(), - TextInput::make('sleep') - ->required() - ->numeric() - ->default(30), - TextInput::make('limit') - ->required() - ->numeric() - ->default(0), + ->selectablePlaceholder(true), + Fieldset::make('Supervisor or Cron Toggle') + ->schema([ + Toggle::make('is_cron')->live(), + TextInput::make('sleep') + ->label('Sleep between loops') + ->hidden(fn (Get $get): bool => $get('is_cron')) + ->numeric() + ->default(30), + ])->columnSpan(2), ]); } } diff --git a/app/Filament/Resources/Supervisors/Tables/SupervisorsTable.php b/app/Filament/Resources/Supervisors/Tables/SupervisorsTable.php index 23e542de..b73aa150 100644 --- a/app/Filament/Resources/Supervisors/Tables/SupervisorsTable.php +++ b/app/Filament/Resources/Supervisors/Tables/SupervisorsTable.php @@ -2,9 +2,11 @@ namespace App\Filament\Resources\Supervisors\Tables; +use App\Models\Bookmaker; 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\Columns\ToggleColumn; use Filament\Tables\Table; @@ -18,6 +20,7 @@ class SupervisorsTable TextColumn::make('id')->badge(), TextColumn::make('name') ->searchable(), + TextColumn::make('type')->badge(), TextColumn::make('provider.name') ->badge()->color(fn (string $state): string => match ($state) { 'txodds' => 'danger', @@ -25,15 +28,19 @@ class SupervisorsTable 'direct' => 'primary', default => 'warning', }), - TextColumn::make('sport_id')->label('Sport'), - TextColumn::make('bookmaker_id')->label('Book'), + TextColumn::make('sport.name')->label('Sport'), + IconColumn::make('bookmaker_id') + ->label('Book') + ->icon(function ($state): string { + if ($state) { + return 'bkm-'.Bookmaker::where('id', $state)->pluck('icon')->first(); + } + }), TextColumn::make('sleep')->numeric(), - TextColumn::make('limit')->numeric(), - TextColumn::make('runtime')->label('Duration'), - TextColumn::make('events')->numeric(), + TextColumn::make('runtime'), TextColumn::make('lastcall'), - ToggleColumn::make('is_cron')->label('Cron'), - ToggleColumn::make('is_active')->label('Status'), + IconColumn::make('is_cron')->boolean()->label('Cron')->falseColor('gray'), + ToggleColumn::make('is_active')->label('On/Off'), TextColumn::make('created_at') ->dateTime() ->sortable() diff --git a/app/Models/Supervisor.php b/app/Models/Supervisor.php index 21aac974..c79bcc87 100644 --- a/app/Models/Supervisor.php +++ b/app/Models/Supervisor.php @@ -8,6 +8,7 @@ class Supervisor extends Model { protected $fillable = [ 'name', + 'type', 'provider_id', 'sport_id', 'bookmaker_id', diff --git a/composer.lock b/composer.lock index 20042dab..a354ff66 100644 --- a/composer.lock +++ b/composer.lock @@ -1845,22 +1845,22 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.9.3", + "version": "7.10.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77" + "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", - "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", + "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.5.3 || ^2.0.3", - "guzzlehttp/psr7": "^2.7.0", + "guzzlehttp/promises": "^2.3", + "guzzlehttp/psr7": "^2.8", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -1951,7 +1951,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.9.3" + "source": "https://github.com/guzzle/guzzle/tree/7.10.0" }, "funding": [ { @@ -1967,20 +1967,20 @@ "type": "tidelift" } ], - "time": "2025-03-27T13:37:11+00:00" + "time": "2025-08-23T22:36:01+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.2.0", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c" + "reference": "481557b130ef3790cf82b713667b43030dc9c957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c", - "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c", + "url": "https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957", + "reference": "481557b130ef3790cf82b713667b43030dc9c957", "shasum": "" }, "require": { @@ -1988,7 +1988,7 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.39 || ^9.6.20" + "phpunit/phpunit": "^8.5.44 || ^9.6.25" }, "type": "library", "extra": { @@ -2034,7 +2034,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.2.0" + "source": "https://github.com/guzzle/promises/tree/2.3.0" }, "funding": [ { @@ -2050,20 +2050,20 @@ "type": "tidelift" } ], - "time": "2025-03-27T13:27:01+00:00" + "time": "2025-08-22T14:34:08+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.7.1", + "version": "2.8.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16" + "reference": "21dc724a0583619cd1652f673303492272778051" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16", - "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051", + "reference": "21dc724a0583619cd1652f673303492272778051", "shasum": "" }, "require": { @@ -2079,7 +2079,7 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", "http-interop/http-factory-tests": "0.9.0", - "phpunit/phpunit": "^8.5.39 || ^9.6.20" + "phpunit/phpunit": "^8.5.44 || ^9.6.25" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" @@ -2150,7 +2150,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.7.1" + "source": "https://github.com/guzzle/psr7/tree/2.8.0" }, "funding": [ { @@ -2166,20 +2166,20 @@ "type": "tidelift" } ], - "time": "2025-03-27T12:30:47+00:00" + "time": "2025-08-23T21:21:41+00:00" }, { "name": "guzzlehttp/uri-template", - "version": "v1.0.4", + "version": "v1.0.5", "source": { "type": "git", "url": "https://github.com/guzzle/uri-template.git", - "reference": "30e286560c137526eccd4ce21b2de477ab0676d2" + "reference": "4f4bbd4e7172148801e76e3decc1e559bdee34e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/uri-template/zipball/30e286560c137526eccd4ce21b2de477ab0676d2", - "reference": "30e286560c137526eccd4ce21b2de477ab0676d2", + "url": "https://api.github.com/repos/guzzle/uri-template/zipball/4f4bbd4e7172148801e76e3decc1e559bdee34e1", + "reference": "4f4bbd4e7172148801e76e3decc1e559bdee34e1", "shasum": "" }, "require": { @@ -2188,7 +2188,7 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.36 || ^9.6.15", + "phpunit/phpunit": "^8.5.44 || ^9.6.25", "uri-template/tests": "1.0.0" }, "type": "library", @@ -2236,7 +2236,7 @@ ], "support": { "issues": "https://github.com/guzzle/uri-template/issues", - "source": "https://github.com/guzzle/uri-template/tree/v1.0.4" + "source": "https://github.com/guzzle/uri-template/tree/v1.0.5" }, "funding": [ { @@ -2252,7 +2252,7 @@ "type": "tidelift" } ], - "time": "2025-02-03T10:55:03+00:00" + "time": "2025-08-22T14:27:06+00:00" }, { "name": "jaybizzle/crawler-detect", @@ -2391,16 +2391,16 @@ }, { "name": "joaopaulolndev/filament-edit-profile", - "version": "v2.0.8", + "version": "v2.0.11", "source": { "type": "git", "url": "https://github.com/joaopaulolndev/filament-edit-profile.git", - "reference": "f50ed328b43839e80e0e4071aac09439e46bd77c" + "reference": "1ebf29f947c9f15dd6cb0c992ea77e23115403aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joaopaulolndev/filament-edit-profile/zipball/f50ed328b43839e80e0e4071aac09439e46bd77c", - "reference": "f50ed328b43839e80e0e4071aac09439e46bd77c", + "url": "https://api.github.com/repos/joaopaulolndev/filament-edit-profile/zipball/1ebf29f947c9f15dd6cb0c992ea77e23115403aa", + "reference": "1ebf29f947c9f15dd6cb0c992ea77e23115403aa", "shasum": "" }, "require": { @@ -2460,7 +2460,7 @@ "type": "github" } ], - "time": "2025-08-19T23:50:20+00:00" + "time": "2025-08-24T01:29:06+00:00" }, { "name": "kirschbaum-development/eloquent-power-joins", diff --git a/database/migrations/2023_08_06_085243_create_supervisor_table.php b/database/migrations/2023_08_06_085243_create_supervisor_table.php index 386f7497..38f16cb6 100644 --- a/database/migrations/2023_08_06_085243_create_supervisor_table.php +++ b/database/migrations/2023_08_06_085243_create_supervisor_table.php @@ -14,10 +14,11 @@ return new class extends Migration Schema::create('supervisors', function (Blueprint $table) { $table->id(); $table->string('name'); + $table->string('type'); $table->integer('provider_id')->default(0); - $table->integer('sport_id')->default(0); - $table->integer('bookmaker_id')->default(0); + $table->integer('sport_id')->default(0)->nullable(); + $table->integer('bookmaker_id')->default(0)->nullable(); $table->integer('sleep')->default(10); $table->integer('limit')->default(0); diff --git a/database/migrations/2025_08_24_131703_group.php b/database/migrations/2025_08_24_131703_create_group_table.php similarity index 89% rename from database/migrations/2025_08_24_131703_group.php rename to database/migrations/2025_08_24_131703_create_group_table.php index f54c189c..1f2f703b 100644 --- a/database/migrations/2025_08_24_131703_group.php +++ b/database/migrations/2025_08_24_131703_create_group_table.php @@ -1,6 +1,8 @@