remove days and add tasks

This commit is contained in:
salam committed 2026-07-01 15:44:30 +02:00
1 parent be2a16a812
commit 23a367c493
31 files changed
+237 -464

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@
<string>com.sofascore.grapper</string>
<key>ProgramArguments</key>
<array>
<string>/Users/hermanntelser/Sites/nuhodds_fi4/setup.sh 13</string>
<string>/Users/hermanntelser/Sites/nuhodds_fi4/apple_damon.sh</string>
</array>
<key>StartCalendarInterval</key>
<dict>
@@ -7,10 +7,6 @@ use App\Console\Commands\Grapper\Sofascore\EventsDatabase;
use App\Console\Commands\Grapper\Sofascore\Special;
use App\Console\Commands\Grapper\Sofascore\Tournament;
use App\Console\Commands\Nuh;
use App\Models\SofaScoreCategorie;
use App\Models\SofaScoreDay;
use App\Models\SofaScoreDayTournament;
use App\Models\SofaScoreTournament;
use App\Utilities\Notice;
use DateTime;
use Illuminate\Support\Carbon;
@@ -29,14 +25,6 @@ class Sofascore
{
$debug = Nuh::$options['d'] ?? 0;
if (Nuh::$options['truncate']) {
SofaScoreDayTournament::truncate();
SofaScoreTournament::truncate();
SofaScoreDay::truncate();
SofaScoreCategorie::truncate();
Notice::note('Table SofaScoreDay, SofaScoreDayTournament, SofaScoreTournament, SofaScoreCategorie truncated!', 'b', 1);
}
if (Nuh::$options['t']) {
self::$_days[] = Carbon::now()->format('Y-m-d');
} elseif (Nuh::$options['day']) {
@@ -2,7 +2,6 @@
namespace App\Console\Commands\Grapper\Sofascore;
use App\Console\Commands\Grapper\Sofascore\Tools\LoadDays;
use App\Console\Commands\Grapper\Sofascore\Tools\LoadTournaments;
use App\Console\Commands\Nuh;
use App\Utilities\Notice;
@@ -12,7 +11,7 @@ class EventsDatabase
{
public static $storage_path = '/Console/Commands/Grapper/Sofascore/grapped/';
public static function load()
public static function load($days)
{
$debug = Nuh::$options['d'] ?? 0;
@@ -20,8 +19,6 @@ class EventsDatabase
$langsam = Nuh::$options['l'] ?? 0;
$days = LoadDays::load();
$tornaments = LoadTournaments::load();
if ($print) {
@@ -2,17 +2,14 @@
namespace App\Console\Commands\Grapper\Sofascore\Specials;
use App\Console\Commands\Grapper\Sofascore\Tools\LoadDays;
use App\Utilities\Notice;
use App\Utilities\ZipFolder;
class CreateZip
{
public static function run()
public static function run($days)
{
$days = LoadDays::load();
foreach ($days as $day) {
ZipFolder::create($day);
}
@@ -3,16 +3,13 @@
namespace App\Console\Commands\Grapper\Sofascore\Specials;
use App\Console\Commands\Grapper\Sofascore\Special;
use App\Console\Commands\Grapper\Sofascore\Tools\LoadDays;
use App\Utilities\Notice;
use Illuminate\Support\Facades\Mail;
class SendMail
{
public static function run()
public static function run($days)
{
$days = LoadDays::load();
foreach ($days as $day) {
$zip_file = Special::$storage_path.'/'.$day.'.zip';
@@ -5,7 +5,6 @@ namespace App\Console\Commands\Grapper\Sofascore;
use App\Console\Commands\Nuh;
use App\Models\Country;
use App\Models\SofaScoreCategorie;
use App\Models\SofaScoreDay;
use App\Models\SofaScoreDayTournament;
use App\Models\SofaScoreTournament;
use App\Models\Sport;
@@ -49,10 +48,12 @@ class Tournament
$tournaments_counter = 0;
Notice::note('needs day fixing', 'br', 1);
/**
* grap only one time/sport check
*/
if ($force || ! SofaScoreDay::where('day', $day)->where($sport->ss_slug, 1)->first()) {
if ($force) {
if ($debug) {
Notice::note('Grapping Sport: ' . Nuh::$options['sport'] . ' Day: ' . $day, 'p');
@@ -181,7 +182,6 @@ class Tournament
Notice::note("tournaments: $tournaments_counter", 'p');
}
SofaScoreDay::updateOrCreate(['day' => $day], ['sport_id' => $sport->id]);
}
} else {
if ($debug) {
@@ -1,11 +0,0 @@
<?php
namespace App\Filament\Clusters\Grapper\Resources\SofaScoreDays\Pages;
use App\Filament\Clusters\Grapper\Resources\SofaScoreDays\SofaScoreDayResource;
use Filament\Resources\Pages\CreateRecord;
class CreateSofaScoreDay extends CreateRecord
{
protected static string $resource = SofaScoreDayResource::class;
}
@@ -1,19 +0,0 @@
<?php
namespace App\Filament\Clusters\Grapper\Resources\SofaScoreDays\Pages;
use App\Filament\Clusters\Grapper\Resources\SofaScoreDays\SofaScoreDayResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditSofaScoreDay extends EditRecord
{
protected static string $resource = SofaScoreDayResource::class;
protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}
@@ -1,11 +0,0 @@
<?php
namespace App\Filament\Clusters\Grapper\Resources\SofaScoreDays\Pages;
use App\Filament\Clusters\Grapper\Resources\SofaScoreDays\SofaScoreDayResource;
use Filament\Resources\Pages\ListRecords;
class ListSofaScoreDays extends ListRecords
{
protected static string $resource = SofaScoreDayResource::class;
}
@@ -1,16 +0,0 @@
<?php
namespace App\Filament\Clusters\Grapper\Resources\SofaScoreDays\Schemas;
use Filament\Schemas\Schema;
class SofaScoreDayForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
//
]);
}
}
@@ -1,48 +0,0 @@
<?php
namespace App\Filament\Clusters\Grapper\Resources\SofaScoreDays;
use App\Filament\Clusters\Grapper\GrapperCluster;
use App\Filament\Clusters\Grapper\Resources\SofaScoreDays\Pages\ListSofaScoreDays;
use App\Filament\Clusters\Grapper\Resources\SofaScoreDays\Schemas\SofaScoreDayForm;
use App\Filament\Clusters\Grapper\Resources\SofaScoreDays\Tables\SofaScoreDaysTable;
use App\Models\SofaScoreDay;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Tables\Table;
use UnitEnum;
class SofaScoreDayResource extends Resource
{
protected static ?string $model = SofaScoreDay::class;
protected static string|UnitEnum|null $navigationGroup = 'SofaScore';
protected static ?string $recordTitleAttribute = 'Days';
protected static ?string $navigationLabel = 'Days';
protected static ?string $cluster = GrapperCluster::class;
public static function form(Schema $schema): Schema
{
return SofaScoreDayForm::configure($schema);
}
public static function table(Table $table): Table
{
return SofaScoreDaysTable::configure($table);
}
public static function getNavigationBadge(): ?string
{
return parent::getEloquentQuery()->count();
}
public static function getPages(): array
{
return [
'index' => ListSofaScoreDays::route('/'),
];
}
}
@@ -1,156 +0,0 @@
<?php
namespace App\Filament\Clusters\Grapper\Resources\SofaScoreDays\Tables;
use App\Models\SofaScoreDay;
use App\Models\Sport;
use Filament\Actions\Action;
use Filament\Actions\BulkAction;
use Filament\Actions\BulkActionGroup;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Toggle;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\ToggleColumn;
use Filament\Tables\Enums\FiltersLayout;
use Filament\Tables\Filters\Filter;
use Filament\Tables\Filters\Indicator;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Carbon;
class SofaScoreDaysTable
{
public static function configure(Table $table): Table
{
return $table
->description('For days checked events active in tournaments will be grapped.')
->headerActions([
Action::make('generate')->icon('phosphor-calendar')
->schema([
Select::make('sport_id')
->options(Sport::where('is_active', 1)
->pluck('name', 'id'))
->required(),
Select::make('year')
->options(self::years())
->required(),
Select::make('month')
->options(self::month())
->required(),
])
->action(function (array $data, $table): void {
$sport_id = $data['sport_id'];
$date = Carbon::createFromDate($data['year'], $data['month'], 1)->startOfMonth();
$daysCount = $date->daysInMonth;
$allDates = [];
for ($i = 1; $i <= $daysCount; $i++) {
$allDates[] = $date->copy()->day($i)->format('Y-m-d');
}
foreach ($allDates as $day) {
SofaScoreDay::updateOrCreate(['day' => $day, 'sport_id' => $sport_id]);
}
}),
Action::make('reset')
->icon('phosphor-power')
->schema([
Select::make('sport_id')
->options(Sport::where('is_active', 1)
->pluck('name', 'id'))
->required(),
])
->action(function (array $data): void {
$sport_id = $data['sport_id'];
SofaScoreDay::where('sport_id', $sport_id)->update(['enabled' => 0]);
}),
])
->columns([
TextColumn::make('sport.name'),
TextColumn::make('day')->sortable(),
ToggleColumn::make('enabled'),
])
->filters([
Filter::make('filter')
->columns(4)->columnSpan(4)
->schema([
Select::make('sport_id')
->default(1)
->selectablePlaceholder(false)
->label('Sport')
->options(Sport::where('is_active', 1)->pluck('name', 'id')),
Select::make('year')->options(self::years()),
Select::make('month')->options(self::month()),
Toggle::make('enabled'),
])
->query(function (Builder $query, array $data): Builder {
return $query->when(
$data['year'],
fn (Builder $query, $year): Builder => $query->whereYear('day', $year),
)->when(
$data['month'],
fn (Builder $query, $month): Builder => $query->whereMonth('day', $month),
)->when(
$data['enabled'],
fn (Builder $query, $enabled): Builder => $query->where('enabled', $enabled),
);
})->indicateUsing(function (array $data): array {
$indicators = [];
if ($data['year'] ?? null) {
$indicators[] = Indicator::make('Year: '.$data['year']);
}
if ($data['month'] ?? null) {
$indicators[] = Indicator::make('Month: '.$data['month']);
}
return $indicators;
}),
], layout: FiltersLayout::AboveContent)
->persistFiltersInSession()
->deferFilters(false)
->toolbarActions([
BulkActionGroup::make([
BulkAction::make('Enable')
->icon('phosphor-toggle-right-fill')
->color('primary')
->action(function (Collection $records): void {
foreach ($records as $record) {
SofaScoreDay::where('id', '=', $record->id)
->update(
['enabled' => 1]
);
}
}),
BulkAction::make('Disable')
->icon('phosphor-toggle-left-fill')
->color('gray')
->action(function (Collection $records): void {
foreach ($records as $record) {
SofaScoreDay::where('id', '=', $record->id)
->update(
['enabled' => 0]
);
}
}),
])->label('Grapping Day'),
]);
}
public static function years()
{
$years = range(date('Y'), date('Y') - 10);
return array_combine($years, $years);
}
public static function month()
{
$months = [];
for ($m = 1; $m <= 12; $m++) {
$date = Carbon::create(null, $m, 1);
$months[$date->format('m')] = $date->format('F');
}
return $months;
}
}
@@ -2,9 +2,11 @@
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\Pages;
use App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\RelationManagers\SofaScoreTaskTournamentsRelationManager;
use App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\SofaScoreTaskResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
use Guava\FilamentModalRelationManagers\Actions\RelationManagerAction;
class EditSofaScoreTask extends EditRecord
{
@@ -2,9 +2,11 @@
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\Pages;
use App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\RelationManagers\SofaScoreTaskTournamentsRelationManager;
use App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\SofaScoreTaskResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
use Guava\FilamentModalRelationManagers\Actions\RelationManagerAction;
class ListSofaScoreTasks extends ListRecords
{
@@ -0,0 +1,89 @@
<?php
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\RelationManagers;
use App\Models\SofaScoreCategorie;
use App\Models\SofaScoreTournament;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\CreateAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Select;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Schema;
use Filament\Support\Enums\FontWeight;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\ToggleColumn;
use Filament\Tables\Table;
class SofaScoreTaskTournamentsRelationManager extends RelationManager
{
protected static string $relationship = 'sofa_score_task_tournaments';
protected static ?string $title = 'Tournaments';
protected static ?string $navigationLabel = 'Tournaments';
protected static ?string $modelLabel = 'Tournament';
protected static ?string $pluralModelLabel = 'Tournaments';
public function form(Schema $schema): Schema
{
return $schema
->components([
Select::make('sofa_score_categorie_id')
->searchable()
->label('Categorie')
->options(function (Get $get) {
$res = SofaScoreTournament::where('sport_id', $this->getOwnerRecord()['sport_id'])
->groupBy('sofa_score_categorie_id')
->pluck('sofa_score_categorie_id')
->toArray();
return SofaScoreCategorie::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
})
->live(),
Select::make('sofa_score_tournament_id')
->searchable()
->label('Tournament')
->options(fn (Get $get) => SofaScoreTournament::where('sport_id', $this->getOwnerRecord()['sport_id'])
->where('disabled', 0)
->where('sofa_score_categorie_id', $get('sofa_score_categorie_id'))
->pluck('name', 'tournament_id')),
]);
}
public function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('tournament.sofascore_category.name')
->label('Country')
->searchable(),
TextColumn::make('tournament.name')
->weight(FontWeight::Bold)
->searchable(),
ToggleColumn::make('disabled')
->alignCenter(),
])
->filters([
//
])
->headerActions([
CreateAction::make()
->icon('phosphor-plus')
->label('Tournament'),
])
->recordActions([
EditAction::make(),
DeleteAction::make(),
])
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
]);
}
}
@@ -31,9 +31,11 @@ class SofaScoreTaskForm
'range' => '<span class="text-green-600">Grap a date range</span>',
]),
DatePicker::make('day_from')
->required()
->native()
->visible(fn (Get $get): bool => in_array($get('mode'), ['date', 'range'])),
DatePicker::make('day_to')
->required()
->native()
->visible(fn (Get $get): bool => $get('mode') === 'range'),
]);
@@ -22,9 +22,9 @@ class SofaScoreTaskResource extends Resource
protected static ?string $modelLabel = 'SofaScore Tasks';
protected static ?int $navigationSort = 0;
protected static ?int $navigationSort = 1;
protected static string|UnitEnum|null $navigationGroup = 'Statistiko';
protected static string|UnitEnum|null $navigationGroup = 'SofaScore';
public static function form(Schema $schema): Schema
{
@@ -36,13 +36,6 @@ class SofaScoreTaskResource extends Resource
return SofaScoreTasksTable::configure($table);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getNavigationBadge(): ?string
{
return parent::getEloquentQuery()->count();
@@ -2,11 +2,16 @@
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\Tables;
use App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\RelationManagers\SofaScoreTaskTournamentsRelationManager;
use App\Models\SofaScoreTask;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Schemas\Components\Utilities\Set;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\ToggleColumn;
use Filament\Tables\Table;
use Guava\FilamentModalRelationManagers\Actions\RelationManagerAction;
class SofaScoreTasksTable
{
@@ -20,29 +25,46 @@ class SofaScoreTasksTable
->width(30)
->icon(fn ($record) => $record->sport->icon),
TextColumn::make('sport.name'),
IconColumn::make('compleated')
->width('1rem')
->label('Status')
->alignCenter()
->icon(fn (string $state): string => match ($state) {
'0' => 'phosphor-pause-fill',
'1' => 'phosphor-check-fat-fill',
})
->color(fn (string $state): string => match ($state) {
'0' => 'gray',
'1' => 'success',
}),
TextColumn::make('mode')
->label('Grapping dates')
->badge()
->color(fn ($state): string => match ($state) {
'yesterday' => 'warning',
'date' => 'primary',
'range' => 'success',
})
->formatStateUsing(fn (string $state, $record): string => match ($state) {
'yesterday' => 'Every yesterday',
'date' => $record->day_from->format('Y-m-d'),
'range' => $record->day_from.' - '.$record->day_to,
'date' => $record->day_from,
'range' => $record->day_from.' <=> '.$record->day_to,
}),
ToggleColumn::make('is_active')
->alignCenter()
->afterStateUpdated(function ($record) {
SofaScoreTask::where('id', $record->id)->update(['compleated' => 0]);
}),
ToggleColumn::make('is_active')->alignCenter(),
ToggleColumn::make('run_slow')->alignCenter(),
ToggleColumn::make('run_repeatedly')->alignCenter(),
ToggleColumn::make('compleated')->alignCenter(),
])
->filters([
//
])
->recordActions([
EditAction::make(),
RelationManagerAction::make()
->icon('phosphor-trophy-fill')
->iconButton()
->modalHeading('Add tournaments to sofascore grapper task')
->relationManager(SofaScoreTaskTournamentsRelationManager::make())
->compact(),
EditAction::make()->iconButton()
->icon('phosphor-calendar-fill'),
DeleteAction::make()->iconButton(),
]);
}
}
@@ -1,8 +1,8 @@
<?php
namespace App\Filament\Clusters\Grapper\Resources\SofaScoreTournaments\Pages;
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Pages;
use App\Filament\Clusters\Grapper\Resources\SofaScoreTournaments\SofaScoreTournamentResource;
use App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\SofaScoreTournamentResource;
use Filament\Resources\Pages\CreateRecord;
class CreateSofaScoreTournament extends CreateRecord
@@ -1,8 +1,8 @@
<?php
namespace App\Filament\Clusters\Grapper\Resources\SofaScoreTournaments\Pages;
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Pages;
use App\Filament\Clusters\Grapper\Resources\SofaScoreTournaments\SofaScoreTournamentResource;
use App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\SofaScoreTournamentResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
@@ -1,8 +1,8 @@
<?php
namespace App\Filament\Clusters\Grapper\Resources\SofaScoreTournaments\Pages;
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Pages;
use App\Filament\Clusters\Grapper\Resources\SofaScoreTournaments\SofaScoreTournamentResource;
use App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\SofaScoreTournamentResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
@@ -1,6 +1,6 @@
<?php
namespace App\Filament\Clusters\Grapper\Resources\SofaScoreTournaments\Schemas;
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Schemas;
use Filament\Schemas\Schema;
@@ -1,11 +1,11 @@
<?php
namespace App\Filament\Clusters\Grapper\Resources\SofaScoreTournaments;
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments;
use App\Filament\Clusters\Grapper\GrapperCluster;
use App\Filament\Clusters\Grapper\Resources\SofaScoreTournaments\Pages\ListSofaScoreTournaments;
use App\Filament\Clusters\Grapper\Resources\SofaScoreTournaments\Schemas\SofaScoreTournamentForm;
use App\Filament\Clusters\Grapper\Resources\SofaScoreTournaments\Tables\SofaScoreTournamentsTable;
use App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Pages\ListSofaScoreTournaments;
use App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Schemas\SofaScoreTournamentForm;
use App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Tables\SofaScoreTournamentsTable;
use App\Filament\Clusters\StaticData\StaticDataCluster;
use App\Models\SofaScoreTournament;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
@@ -19,12 +19,13 @@ class SofaScoreTournamentResource extends Resource
protected static string|UnitEnum|null $navigationGroup = 'SofaScore';
protected static ?string $cluster = GrapperCluster::class;
protected static ?string $cluster = StaticDataCluster::class;
protected static ?string $recordTitleAttribute = 'Tournaments';
protected static ?string $navigationLabel = 'Tournaments';
protected static ?int $navigationSort = 2;
public static function form(Schema $schema): Schema
{
@@ -1,17 +1,14 @@
<?php
namespace App\Filament\Clusters\Grapper\Resources\SofaScoreTournaments\Tables;
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Tables;
use App\Models\SofaScoreCategorie;
use App\Models\SofaScoreDayTournament;
use App\Models\SofaScoreTournament;
use App\Models\Sport;
use Filament\Actions\Action;
use Filament\Actions\BulkAction;
use Filament\Actions\BulkActionGroup;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Toggle;
use Filament\Forms\Components\ToggleButtons;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Support\Enums\IconSize;
@@ -29,35 +26,6 @@ class SofaScoreTournamentsTable
public static function configure(Table $table): Table
{
return $table
->headerActions([
Action::make('grapping')
->icon('phosphor-power')
->tooltip('Will stop grapping for selected sport')
->schema([
Select::make('sport')
->options(Sport::where('is_active', 1)
->pluck('name', 'id'))
->required(),
])
->action(function (array $data): void {
$sport_id = $data['sport_id'];
SofaScoreTournament::where('sport_id', $sport_id)->update(['enabled' => 0]);
}),
Action::make('disabled')
->icon('phosphor-power')
->tooltip('Will activate all disabled leagues for selected sport')
->schema([
Select::make('sport')
->options(Sport::where('is_active', 1)
->pluck('name', 'id'))
->required(),
])
->action(function (array $data): void {
$sport_id = $data['sport_id'];
SofaScoreTournament::where('sport_id', $sport_id)->update(['disabled' => 0]);
}),
])
->poll()
->columns([
IconColumn::make('sport.icon')
->label('')
@@ -73,7 +41,7 @@ class SofaScoreTournamentsTable
TextColumn::make('sofascore_category.name')
->icon(fn ($record) => $record->sofascore_category->country->icon),
TextColumn::make('name')->searchable()->sortable(),
ToggleColumn::make('enabled')->label('Enable'),
// ToggleColumn::make('enabled')->label('Enable'),
ToggleColumn::make('disabled')->label('Disable'),
])
->filters([
@@ -103,15 +71,15 @@ class SofaScoreTournamentsTable
return SofaScoreCategorie::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
})
->live(),
ToggleButtons::make('filter-grapping')
->inline()
->columnSpan(2)
->default('active')
->options([
'all' => 'All',
'active' => 'Active',
'disabled' => 'Disabled',
]),
// ToggleButtons::make('filter-grapping')
// ->inline()
// ->columnSpan(2)
// ->default('active')
// ->options([
// 'all' => 'All',
// 'active' => 'Active',
// 'disabled' => 'Disabled',
// ]),
ToggleButtons::make('filter-disabled')
->inline()
->columnSpan(2)
+5
View File
@@ -24,4 +24,9 @@ class SofaScoreTask extends Model
{
return $this->belongsTo(Sport::class);
}
public function sofa_score_task_tournaments()
{
return $this->hasMany(SofaScoreTaskTournament::class);
}
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SofaScoreTaskTournament extends Model
{
protected $fillable = [
'sofa_score_task_id',
'sofa_score_tournament_id',
'disabled',
];
public function sofa_score_task_tournaments()
{
return $this->belongsTo(SofaScoreTask::class);
}
public function tournament()
{
return $this->belongsTo(SofaScoreTournament::class, 'sofa_score_tournament_id', 'tournament_id');
}
}
+3
View File
@@ -72,6 +72,9 @@ class AppServiceProvider extends ServiceProvider
'info' => Color::Blue,
'success' => Color::Green,
'warning' => Color::Amber,
'sky' => Color::Sky,
'yellow' => Color::Yellow,
'teal' => Color::Teal,
]);
}
}
Executable
+24
View File
@@ -0,0 +1,24 @@
# AUTO GRAPPER SOFASCORE
echo "\n⚽ close all open vpn"
killall ssh
# echo "\n⚽ open vpn tunnel to prod"
# ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190
# echo "\n⚽ copy active tournaments"
# php artisan nuh --d --f 73 --prc=2
# echo "\n⚽ close tunnel"
# killall ssh
# echo "\n⚽ grapp data sofascore"
# php artisan nuh --d --f --y 72
# echo "\n⚽ create zip archive"
# php artisan nuh --d --f --y 73 --prc=3
# echo "\n⚽ mail archive"
# php artisan nuh --d --f --y 73 --prc=4
# echo "\n😎 done :)"
+1 -1
View File
@@ -16,7 +16,7 @@
"codeat3/blade-phosphor-icons": "*",
"codewithkyrian/filament-date-range": "^2.2",
"filament/filament": "^5.3",
"guava/filament-modal-relation-managers": "^3.0",
"guava/filament-modal-relation-managers": "^3.1",
"joaopaulolndev/filament-edit-profile": "^3.0",
"laravel/framework": "*",
"laravel/tinker": "*",
Generated
+13 -93
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "f2008484d55fed9d274d3f2ad273d65f",
"content-hash": "dea2c9fda74951c05718378dc9b3c9fe",
"packages": [
{
"name": "agencetwogether/hookshelper",
@@ -4457,24 +4457,24 @@
},
{
"name": "mongodb/mongodb",
"version": "2.3.0",
"version": "2.2.0",
"source": {
"type": "git",
"url": "https://github.com/mongodb/mongo-php-library",
"reference": "12e56461166d915e3dd8e4969ad0940ed5207d88"
"url": "https://github.com/mongodb/mongo-php-library.git",
"reference": "bbb13f969e37e047fd822527543df55fdc1c9298"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/12e56461166d915e3dd8e4969ad0940ed5207d88",
"reference": "12e56461166d915e3dd8e4969ad0940ed5207d88",
"url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/bbb13f969e37e047fd822527543df55fdc1c9298",
"reference": "bbb13f969e37e047fd822527543df55fdc1c9298",
"shasum": ""
},
"require": {
"composer-runtime-api": "^2.0",
"ext-mongodb": "^2.3",
"ext-mongodb": "^2.2",
"php": "^8.1",
"psr/log": "^1.1.4|^2|^3",
"symfony/polyfill-php85": "^1.33"
"symfony/polyfill-php85": "^1.32"
},
"replace": {
"mongodb/builder": "*"
@@ -4526,7 +4526,11 @@
"mongodb",
"persistence"
],
"time": "2026-04-28T12:50:06+00:00"
"support": {
"issues": "https://github.com/mongodb/mongo-php-library/issues",
"source": "https://github.com/mongodb/mongo-php-library/tree/2.2.0"
},
"time": "2026-02-11T11:39:56+00:00"
},
{
"name": "monolog/monolog",
@@ -8023,90 +8027,6 @@
],
"time": "2026-04-10T16:19:22+00:00"
},
{
"name": "symfony/polyfill-iconv",
"version": "v1.37.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-iconv.git",
"reference": "2c5729fd241b4b22f6e4b436bc3354a4f262df57"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/2c5729fd241b4b22f6e4b436bc3354a4f262df57",
"reference": "2c5729fd241b4b22f6e4b436bc3354a4f262df57",
"shasum": ""
},
"require": {
"php": ">=7.2"
},
"provide": {
"ext-iconv": "*"
},
"suggest": {
"ext-iconv": "For best performance"
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/polyfill",
"name": "symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Iconv\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Iconv extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"iconv",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-iconv/tree/v1.37.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2026-04-10T16:19:22+00:00"
},
{
"name": "symfony/polyfill-intl-grapheme",
"version": "v1.38.1",
@@ -11,11 +11,11 @@ return new class extends Migration
*/
public function up(): void
{
Schema::create('sofa_score_days', function (Blueprint $table) {
Schema::create('sofa_score_task_tournaments', function (Blueprint $table) {
$table->id();
$table->date('day')->index();
$table->integer('sport_id')->index()->references('id')->on('sports');
$table->boolean('enabled')->index()->default(0);
$table->integer('sofa_score_task_id')->index()->references('id')->on('sofa_score_tasks');
$table->integer('sofa_score_tournament_id')->index()->references('id')->on('sofa_score_tournaments');
$table->boolean('disabled')->default(0);
$table->timestamps();
});
}
@@ -25,6 +25,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::dropIfExists('sofa_score_days');
Schema::dropIfExists('sofa_score_task_tournaments');
}
};