This commit is contained in:
salam committed 2026-07-14 12:56:24 +02:00
1 parent 68a1ec1769
commit 987d096928
8 files changed
+149 -154

No files matched your search

+1 -1
View File
@@ -1,3 +1,3 @@
1) Find double 1) Find double
2) Download all data 2) Download all data
3) fix grapper 3) fix grapper make only in tournament on/off, in Task only Dates
@@ -2,7 +2,7 @@
namespace App\Console\Commands\Grapper\Sofascore; namespace App\Console\Commands\Grapper\Sofascore;
use App\Console\Commands\Grapper\Sofascore\Helper\LoadDays; use App\Console\Commands\Grapper\Sofascore;
use App\Console\Commands\Nuh; use App\Console\Commands\Nuh;
use App\Utilities\Notice; use App\Utilities\Notice;
use App\Utilities\ZipFolder; use App\Utilities\ZipFolder;
@@ -13,14 +13,7 @@ class CreateZip
{ {
$debug = Nuh::$options['d'] ?? 0; $debug = Nuh::$options['d'] ?? 0;
$days = LoadDays::load(); ZipFolder::create(Sofascore::$storage);
foreach ($days as $d) {
$day = $d['day'];
ZipFolder::create($day);
}
if ($debug) { if ($debug) {
Notice::note('zips created', 'bb'); Notice::note('zips created', 'bb');
@@ -27,82 +27,73 @@ class SofaScoreTournamentsTable
{ {
return $table return $table
->columns([ ->columns([
IconColumn::make('sport.icon') IconColumn::make('sport.icon')
->label('') ->label('')
->grow(false) ->grow(false)
->width(30) ->width(30)
->color(fn ($record) => $record->sport->color) ->color(fn($record) => $record->sport->color)
->icon(fn ($record) => $record->sport->icon) ->icon(fn($record) => $record->sport->icon)
->size(IconSize::Medium) ->size(IconSize::Medium)
->tooltip(fn ($record) => $record->id) ->tooltip(fn($record) => $record->id)
->visibleFrom('lg'), ->visibleFrom('lg'),
TextColumn::make('tournament_id')->sortable()->searchable(), TextColumn::make('tournament_id')->sortable()->searchable(),
TextColumn::make('sport.name'), TextColumn::make('sport.name'),
TextColumn::make('sofascore_category.name') TextColumn::make('sofascore_category.name')
->icon(fn ($record) => $record->sofascore_category->country->icon), ->icon(fn($record) => $record->sofascore_category->country->icon),
TextColumn::make('name')->searchable()->sortable(), TextColumn::make('name')->searchable()->sortable(),
// ToggleColumn::make('enabled')->label('Enable'), ToggleColumn::make('enabled')->label('Enable'),
ToggleColumn::make('disabled')->label('Disable'), ToggleColumn::make('disabled')->label('Hidden'),
]) ])
->filters([ ->filters([
Filter::make('filters') Filter::make('filters')
->columns(7)->columnSpan(7) ->columns(7)->columnSpan(7)
->schema([ ->schema([
Select::make('sport_id') Select::make('sport_id')
->default(1) ->default(1)
->selectablePlaceholder(false) ->selectablePlaceholder(false)
->label('Sport') ->label('Sport')
->options(Sport::where('is_active', 1)->pluck('name', 'id')) ->options(Sport::where('is_active', 1)->pluck('name', 'id'))
->afterStateUpdated(function (callable $set) { ->afterStateUpdated(function (callable $set) {
$set('sofa_score_categorie_id', null); $set('sofa_score_categorie_id', null);
}) })
->live(), ->live(),
Select::make('sofa_score_categorie_id') Select::make('sofa_score_categorie_id')
->searchable() ->searchable()
->multiple() ->multiple()
->columnSpan(2) ->columnSpan(2)
->label('Categorie') ->label('Categorie')
->options(function (Get $get) { ->options(function (Get $get) {
$res = SofaScoreTournament::where('sport_id', $get('sport_id')) $res = SofaScoreTournament::where('sport_id', $get('sport_id'))
->groupBy('sofa_score_categorie_id') ->groupBy('sofa_score_categorie_id')
->pluck('sofa_score_categorie_id') ->pluck('sofa_score_categorie_id')
->toArray(); ->toArray();
return SofaScoreCategorie::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id'); return SofaScoreCategorie::query()->whereIn('id', $res)->orderBy('name')->pluck('name', 'id');
}) })
->live(), ->live(),
// ToggleButtons::make('filter-grapping') ToggleButtons::make('filter-disabled')
// ->inline() ->inline()
// ->columnSpan(2) ->columnSpan(2)
// ->default('active') ->default('active')
// ->options([ ->options([
// 'all' => 'All', 'all' => 'All',
// 'active' => 'Active', 'enabled' => 'Enabled',
// 'disabled' => 'Disabled', 'hidden' => 'Hidden',
// ]), ]),
ToggleButtons::make('filter-disabled') ])
->inline() ->query(function (Builder $query, array $data): Builder {
->columnSpan(2) return $query->when(
->default('active') $data['sport_id'],
->options([ fn(Builder $query, $sport_id) => $query->where('sport_id', $sport_id)
'all' => 'All', )->when(
'active' => 'Active', $data['sofa_score_categorie_id'],
'hidden' => 'Hidden', function (Builder $query, $sofa_score_categorie_id) {
]), if (is_array($sofa_score_categorie_id)) {
]) $query->whereIn('sofa_score_categorie_id', $sofa_score_categorie_id);
->query(function (Builder $query, array $data): Builder { } else {
return $query->when( $query->where('sofa_score_categorie_id', $sofa_score_categorie_id);
$data['sport_id'],
fn (Builder $query, $sport_id) => $query->where('sport_id', $sport_id)
)->when(
$data['sofa_score_categorie_id'],
function (Builder $query, $sofa_score_categorie_id) {
if (is_array($sofa_score_categorie_id)) {
$query->whereIn('sofa_score_categorie_id', $sofa_score_categorie_id);
} else {
$query->where('sofa_score_categorie_id', $sofa_score_categorie_id);
}
} }
}
// )->when( // )->when(
// $data['filter-grapping'], // $data['filter-grapping'],
// function (Builder $query, $filtergrapping) { // function (Builder $query, $filtergrapping) {
@@ -115,71 +106,71 @@ class SofaScoreTournamentsTable
// break; // break;
// } // }
// } // }
)->when( )->when(
$data['filter-disabled'], $data['filter-disabled'],
function (Builder $query, $filterdisabled) { function (Builder $query, $filterdisabled) {
switch ($filterdisabled) { switch ($filterdisabled) {
case 'active': case 'enabled':
$query->where('disabled', 0); $query->where('enabled', 1);
break; break;
case 'hidden': case 'hidden':
$query->where('disabled', 1); $query->where('disabled', 1);
break; break;
}
} }
); }
}), );
}),
], layout: FiltersLayout::AboveContent) ], layout: FiltersLayout::AboveContent)
->deferFilters(false) ->deferFilters(false)
->toolbarActions([ ->toolbarActions([
BulkActionGroup::make([ BulkActionGroup::make([
BulkAction::make('Enable') BulkAction::make('Enable selected')
->icon('phosphor-toggle-right-fill') ->icon('phosphor-toggle-right-fill')
->color('primary') ->color('primary')
->action(function (Collection $records): void { ->action(function (Collection $records): void {
foreach ($records as $record) { foreach ($records as $record) {
SofaScoreTournament::where('id', '=', $record->id) SofaScoreTournament::where('id', '=', $record->id)
->update( ->update(
['enabled' => 1] ['enabled' => 1]
); );
} }
}), }),
BulkAction::make('Disable') BulkAction::make('Disable selected')
->icon('phosphor-toggle-left-fill') ->icon('phosphor-toggle-left-fill')
->color('gray') ->color('gray')
->action(function (Collection $records): void { ->action(function (Collection $records): void {
foreach ($records as $record) { foreach ($records as $record) {
SofaScoreTournament::where('id', '=', $record->id) SofaScoreTournament::where('id', '=', $record->id)
->update( ->update(
['enabled' => 0] ['enabled' => 0]
); );
} }
}), }),
])->label('Grapping'), ])->label('Grapping'),
BulkActionGroup::make([ BulkActionGroup::make([
BulkAction::make('Hide') BulkAction::make('Hide selected')
->icon('phosphor-toggle-right-fill') ->icon('phosphor-toggle-right-fill')
->color('primary') ->color('primary')
->action(function (Collection $records): void { ->action(function (Collection $records): void {
foreach ($records as $record) { foreach ($records as $record) {
SofaScoreTournament::where('id', '=', $record->id) SofaScoreTournament::where('id', '=', $record->id)
->update( ->update(
['disabled' => 1] ['disabled' => 1]
); );
} }
}), }),
BulkAction::make('Show') BulkAction::make('Show selected')
->icon('phosphor-toggle-left-fill') ->icon('phosphor-toggle-left-fill')
->color('gray') ->color('gray')
->action(function (Collection $records): void { ->action(function (Collection $records): void {
foreach ($records as $record) { foreach ($records as $record) {
SofaScoreTournament::where('id', '=', $record->id) SofaScoreTournament::where('id', '=', $record->id)
->update( ->update(
['disabled' => 0] ['disabled' => 0]
); );
} }
}), }),
])->label('Disabled'), ])->label('Hidden'),
]); ]);
} }
} }
@@ -29,7 +29,7 @@ class EventResource extends Resource
public static function getPluralModelLabel(): string public static function getPluralModelLabel(): string
{ {
return false; return 'Monitor';
} }
public static function form(Schema $schema): Schema public static function form(Schema $schema): Schema
@@ -50,9 +50,9 @@ class AdminPanelProvider extends PanelProvider
->columnMapping(false) ->columnMapping(false)
->exporter(BetfairExporter::class) ->exporter(BetfairExporter::class)
->label('Download Betfair') ->label('Download Betfair')
->visible(fn (): bool => auth()->user()->hasRole('download_betfair')) ->visible(fn(): bool => auth()->user()->hasRole('download_betfair'))
->fileName(fn (Export $export): string => 'betfair-odds-'.date('d.m.Y-H.i')."-{$export->getKey()}") ->fileName(fn(Export $export): string => 'betfair-odds-' . date('d.m.Y-H.i') . "-{$export->getKey()}")
->modifyQueryUsing(fn (Builder $query) => $query->whereHas('odds_3ways_bf') ->modifyQueryUsing(fn(Builder $query) => $query->whereHas('odds_3ways_bf')
->whereHas('odds_totals_bf') ->whereHas('odds_totals_bf')
->where('sport_id', 1)) ->where('sport_id', 1))
->icon('phosphor-download'), ->icon('phosphor-download'),
@@ -69,9 +69,10 @@ class AdminPanelProvider extends PanelProvider
->default() ->default()
->globalSearch(false) ->globalSearch(false)
->globalSearchKeyBindings(['command+k', 'ctrl+k']) ->globalSearchKeyBindings(['command+k', 'ctrl+k'])
->brandLogo(asset('images/statistiko-d.svg')) ->brandLogo(asset('logo/statistiko.svg'))
->darkModeBrandLogo(asset('images/statistiko.svg')) ->darkModeBrandLogo(asset('logo/statistiko-d.svg'))
->favicon(asset('images/nuh.svg')) ->favicon(asset('logo/sta.svg'))
->brandName('')
->brandLogoHeight('2rem') ->brandLogoHeight('2rem')
->unsavedChangesAlerts() ->unsavedChangesAlerts()
->topNavigation() ->topNavigation()
@@ -92,8 +93,8 @@ class AdminPanelProvider extends PanelProvider
->sidebarCollapsibleOnDesktop(false) ->sidebarCollapsibleOnDesktop(false)
->userMenuItems([ ->userMenuItems([
'profile' => Action::make('profile') 'profile' => Action::make('profile')
->label(fn () => Auth::user()->name) ->label(fn() => Auth::user()->name)
->url(fn (): string => EditProfilePage::getUrl()) ->url(fn(): string => EditProfilePage::getUrl())
->icon('phosphor-user-circle-fill'), ->icon('phosphor-user-circle-fill'),
]) ])
->pages([ ->pages([
+4 -3
View File
@@ -9,13 +9,14 @@ use ZipArchive;
class ZipFolder class ZipFolder
{ {
public static function create(string $day) public static function create(string $path)
{ {
$zipFilePath = Sofascore::$storage . '/' . $day . '.zip'; // $zipFilePath = Sofascore::$storage . '/' . $day . '.zip';
$path = Sofascore::$storage . '/' . $day; // $path = Sofascore::$storage . '/' . $day;
$zipFilePath = $path . '/archive.zip';
$zip = new ZipArchive(); $zip = new ZipArchive();
if ($zip->open($zipFilePath, ZipArchive::CREATE | ZipArchive::OVERWRITE) === true) { if ($zip->open($zipFilePath, ZipArchive::CREATE | ZipArchive::OVERWRITE) === true) {
+2 -2
View File
@@ -41,8 +41,8 @@ case "$1" in
# echo "\n⚽ TaskConfig end" # echo "\n⚽ TaskConfig end"
# php artisan nuh --d --f 67 --fun=6 --task=$1 # php artisan nuh --d --f 67 --fun=6 --task=$1
# echo "\n⚽ CreateZip" echo "\n⚽ CreateZip"
# php artisan nuh --d --f 67 --fun=7 --task=$1 php artisan nuh --d --f 67 --fun=7 --task=$1
# echo "\n⚽ SendMail" # echo "\n⚽ SendMail"
# php artisan nuh --d --f 67 --fun=8 --task=$1 # php artisan nuh --d --f 67 --fun=8 --task=$1
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 200 169" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g transform="matrix(0.1,0,0,-0.172449,0,169)">
<path d="M146,877C78,788 54,665 85,569C95,539 123,475 148,425C187,348 194,326 194,275C194,211 174,160 124,101C110,83 100,67 103,64C113,54 393,60 405,70C430,90 469,178 481,238C497,321 484,379 420,509C393,563 367,626 362,648C346,718 372,798 436,878L463,910L171,910L146,877Z" style="fill-rule:nonzero;"/>
<path d="M510,910L510,730L700,730L700,60L960,60L960,729L1037,732L1113,735L1136,820C1149,867 1160,906 1160,908C1160,909 1014,910 835,910L510,910Z" style="fill-rule:nonzero;"/>
<path d="M1237,853C1165,691 1145,560 1154,321C1157,224 1163,127 1168,105L1175,65L1308,62C1380,61 1440,63 1440,67C1440,71 1434,109 1426,150C1418,191 1410,256 1408,293L1405,361L1615,361L1612,293C1609,231 1597,139 1583,82L1578,59L1844,65L1852,104C1867,174 1875,389 1868,496C1860,614 1832,737 1791,838L1763,905L1513,908L1263,910L1237,853ZM1543,783C1566,731 1610,579 1610,551C1610,544 1575,540 1510,540C1445,540 1410,544 1410,551C1410,604 1492,840 1510,840C1514,840 1529,814 1543,783Z" style="fill-rule:nonzero;"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB