This commit is contained in:
salam committed 2026-06-06 12:01:53 +02:00
1 parent 57c695c247
commit d4dfb9748c
19 files changed
+269 -7252

No files matched your search

@@ -0,0 +1,29 @@
<?php
namespace App\Console\Commands\Grapper;
use App\Console\Commands\Grapper\Sportscore\Helper;
use App\Console\Commands\Nuh;
use App\Models\Sport;
class Sofascore
{
public static $auth_header = [];
public static $base_url = '';
public static $sport = [];
public static function switch()
{
self::$sport = Helper::map();
dd(self::$sport, Nuh::$options);
$debug = Nuh::$options['d'] ?? 0;
$echo_data = Nuh::$options['e'] ?? 0;
$sportmap = Sport::map('logi', 1, [Nuh::$options['sport_id']]);
}
}
@@ -0,0 +1,38 @@
<?php
namespace App\Console\Commands\Grapper\Sportscore;
class Helper
{
// football
// basketball
// tennis
// ice-hockey
// baseball
public static function map()
{
return [
1 => [
'name' => 'Soccer',
'slug' => 'football',
],
2 => [
'name' => 'Basketball',
'slug' => 'basketball',
],
4 => [
'name' => 'Ice Hockey',
'slug' => 'ice-hockey',
],
5 => [
'name' => 'Tennis',
'slug' => 'tennis',
],
64 => [
'name' => 'Baseball',
'slug' => 'baseball',
],
];
}
}
@@ -0,0 +1,14 @@
* Get basic list of league_id for all days in 2026-06
https://www.sofascore.com/api/v1/calendar/2026-06/7200/football/unique-tournaments
* with an ID and the date get all scheduled events for this day
* almost all infos are in this link
https://www.sofascore.com/api/v1/unique-tournament/152/scheduled-events/2026-06-01
* Odds for events get ID from previouse link
https://www.sofascore.com/api/v1/event/15235580/odds/1/all
* All player info in dis link
https://www.sofascore.com/api/v1/event/15235580/lineups
+5
View File
@@ -8,6 +8,7 @@ use App\Console\Commands\Grapper\Betsapi;
use App\Console\Commands\Grapper\Goldbet;
use App\Console\Commands\Grapper\Logifuture;
use App\Console\Commands\Grapper\Magloo;
use App\Console\Commands\Grapper\Sofascore;
use App\Console\Commands\Grapper\TxOdds;
use App\Console\Commands\Services\Services;
use App\Models\Supervisor;
@@ -121,6 +122,10 @@ class Nuh extends Command
// DB MAPPER
AutoMapper::switch();
break;
case 12:
// SOFASCORE
Sofascore::switch();
break;
default:
Notice::note('Provider not defined', 'r', 1);
break;
@@ -0,0 +1,11 @@
<?php
namespace App\Filament\Clusters\StaticData\Resources\SofaScores\Pages;
use App\Filament\Clusters\StaticData\Resources\SofaScores\SofaScoreResource;
use Filament\Resources\Pages\CreateRecord;
class CreateSofaScore extends CreateRecord
{
protected static string $resource = SofaScoreResource::class;
}
@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Clusters\StaticData\Resources\SofaScores\Pages;
use App\Filament\Clusters\StaticData\Resources\SofaScores\SofaScoreResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditSofaScore extends EditRecord
{
protected static string $resource = SofaScoreResource::class;
protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Filament\Clusters\StaticData\Resources\SofaScores\Pages;
use App\Filament\Clusters\StaticData\Resources\SofaScores\SofaScoreResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListSofaScores extends ListRecords
{
protected static string $resource = SofaScoreResource::class;
protected function getHeaderActions(): array
{
return [
CreateAction::make()->label('Download Job')
->icon('phosphor-download'),
];
}
}
@@ -0,0 +1,16 @@
<?php
namespace App\Filament\Clusters\StaticData\Resources\SofaScores\Schemas;
use Filament\Schemas\Schema;
class SofaScoreForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
//
]);
}
}
@@ -0,0 +1,43 @@
<?php
namespace App\Filament\Clusters\StaticData\Resources\SofaScores;
use App\Filament\Clusters\StaticData\Resources\SofaScores\Pages\ListSofaScores;
use App\Filament\Clusters\StaticData\Resources\SofaScores\Schemas\SofaScoreForm;
use App\Filament\Clusters\StaticData\Resources\SofaScores\Tables\SofaScoresTable;
use App\Filament\Clusters\StaticData\StaticDataCluster;
use App\Models\SofaScoreEvent;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Tables\Table;
use UnitEnum;
class SofaScoreResource extends Resource
{
protected static ?string $model = SofaScoreEvent::class;
protected static ?string $cluster = StaticDataCluster::class;
protected static ?string $recordTitleAttribute = 'SofaScoreEvent';
protected static ?string $navigationLabel = 'SofaScore Events';
protected static string|UnitEnum|null $navigationGroup = 'SofaScore';
public static function form(Schema $schema): Schema
{
return SofaScoreForm::configure($schema);
}
public static function table(Table $table): Table
{
return SofaScoresTable::configure($table);
}
public static function getPages(): array
{
return [
'index' => ListSofaScores::route('/'),
];
}
}
@@ -0,0 +1,30 @@
<?php
namespace App\Filament\Clusters\StaticData\Resources\SofaScores\Tables;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Table;
class SofaScoresTable
{
public static function configure(Table $table): Table
{
return $table
->columns([
//
])
->filters([
//
])
->recordActions([
EditAction::make(),
])
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
]);
}
}
@@ -7,6 +7,7 @@ use App\Filament\Clusters\StaticData\Resources\TxoddsMarkets\Schemas\TxoddsMarke
use App\Filament\Clusters\StaticData\Resources\TxoddsMarkets\Tables\TxoddsMarketsTable;
use App\Filament\Clusters\StaticData\StaticDataCluster;
use App\Models\TxoddsMarket;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Tables\Table;
@@ -17,6 +18,8 @@ class TxoddsMarketResource extends Resource
protected static ?string $cluster = StaticDataCluster::class;
protected static string|BackedEnum|null $navigationIcon = 'phosphor-tree-structure';
protected static ?int $navigationSort = 32;
protected static string|\UnitEnum|null $navigationGroup = 'Markets';
+4 -4
View File
@@ -7,10 +7,10 @@ use Illuminate\Database\Eloquent\Model;
class Sport extends Model
{
public static function map($field, $reverse = false, $limit = [])
public static function map(string $field, $reverse = false, $limit = [])
{
if (! in_array($field, ['bapi', 'bwin', 'b365', 'logi', 'magl'])) {
Notice::note('Sport::map wrong option! Possible options: bapi, bwin, b365, logi, magl', 'r', 1);
if (! in_array($field, ['bapi', 'bwin', 'b365', 'logi', 'magl', 'sofascore'])) {
Notice::note('Sport::map wrong option! Possible options: bapi, bwin, b365, logi, magl, sofascore', 'r', 1);
}
if ($reverse) {
@@ -33,7 +33,7 @@ class Sport extends Model
return Sport::query()->where('is_active', 1)->pluck('id')->toArray();
}
public static function getSportForClient($client_id)
public static function getSportForClient(int $client_id)
{
$sports = Client::where('id', $client_id)->value('sport');