wip grap ss tournament
This commit is contained in:
1 parent
d4dfb9748c
commit
292acb879e
31 files changed
+4025
-224
No files matched your search
@@ -2,9 +2,12 @@
|
|||||||
|
|
||||||
namespace App\Console\Commands\Grapper;
|
namespace App\Console\Commands\Grapper;
|
||||||
|
|
||||||
use App\Console\Commands\Grapper\Sportscore\Helper;
|
use App\Console\Commands\Grapper\Sofascore\Tournament;
|
||||||
use App\Console\Commands\Nuh;
|
use App\Console\Commands\Nuh;
|
||||||
use App\Models\Sport;
|
use App\Models\SofaScoreCategorie;
|
||||||
|
use App\Models\SofaScoreDayTournament;
|
||||||
|
use App\Models\SofaScoreTournament;
|
||||||
|
use App\Utilities\Notice;
|
||||||
|
|
||||||
class Sofascore
|
class Sofascore
|
||||||
{
|
{
|
||||||
@@ -12,18 +15,31 @@ class Sofascore
|
|||||||
|
|
||||||
public static $base_url = '';
|
public static $base_url = '';
|
||||||
|
|
||||||
public static $sport = [];
|
public static $sport = [1];
|
||||||
|
|
||||||
public static function switch()
|
public static function switch()
|
||||||
{
|
{
|
||||||
self::$sport = Helper::map();
|
|
||||||
|
|
||||||
dd(self::$sport, Nuh::$options);
|
|
||||||
|
|
||||||
$debug = Nuh::$options['d'] ?? 0;
|
$debug = Nuh::$options['d'] ?? 0;
|
||||||
|
$truncat = Nuh::$options['t'] ?? 0;
|
||||||
|
|
||||||
$echo_data = Nuh::$options['e'] ?? 0;
|
if ($truncat) {
|
||||||
|
SofaScoreDayTournament::truncate();
|
||||||
|
SofaScoreTournament::truncate();
|
||||||
|
SofaScoreCategorie::truncate();
|
||||||
|
}
|
||||||
|
|
||||||
$sportmap = Sport::map('logi', 1, [Nuh::$options['sport_id']]);
|
if ($debug) {
|
||||||
|
Notice::note(Nuh::$options['sport'].' '.Nuh::$options['name'], 'b');
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (Nuh::$options['name']) {
|
||||||
|
case 'TOURNAMENTS':
|
||||||
|
Tournament::load();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// code...
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Grapper\Sofascore;
|
||||||
|
|
||||||
|
use App\Console\Commands\Curl;
|
||||||
|
use App\Console\Commands\Nuh;
|
||||||
|
use App\Models\Country;
|
||||||
|
use App\Models\SofaScoreCategorie;
|
||||||
|
use App\Models\SofaScoreDay;
|
||||||
|
use App\Models\SofaScoreTournament;
|
||||||
|
use App\Models\Sport;
|
||||||
|
use App\Utilities\Notice;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
|
class Events
|
||||||
|
{
|
||||||
|
public static $auth_header = [];
|
||||||
|
|
||||||
|
public static $base_url = '';
|
||||||
|
|
||||||
|
public static $sport = [1];
|
||||||
|
|
||||||
|
public static function switch()
|
||||||
|
{
|
||||||
|
$debug = Nuh::$options['d'] ?? 0;
|
||||||
|
|
||||||
|
$sportmap = Sport::whereIn('id', self::$sport)->select('id', 'sofascore', 'ss_slug')->get();
|
||||||
|
|
||||||
|
$time_zone_offset = 0;
|
||||||
|
|
||||||
|
$years_back = 7;
|
||||||
|
|
||||||
|
$dates = Carbon::now()->subYears($years_back);
|
||||||
|
|
||||||
|
SofaScoreTournament::truncate();
|
||||||
|
SofaScoreCategorie::truncate();
|
||||||
|
|
||||||
|
foreach ($sportmap as $sport) {
|
||||||
|
|
||||||
|
while ($dates <= Carbon::now()) {
|
||||||
|
|
||||||
|
$day = $dates->format('Y-m-d');
|
||||||
|
|
||||||
|
SofaScoreDay::updateOrCreate(['day' => $day], [$sport->ss_slug => 1]);
|
||||||
|
|
||||||
|
$page = 1;
|
||||||
|
|
||||||
|
while ($page) {
|
||||||
|
$url = Nuh::$options['base_url']."api/v1/sport/$sport->ss_slug/scheduled-tournaments/$day/page/$page";
|
||||||
|
|
||||||
|
$data = Curl::load($url);
|
||||||
|
|
||||||
|
if ($data['hasNextPage']) {
|
||||||
|
$page++;
|
||||||
|
} else {
|
||||||
|
$page = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($data['scheduled'] as $row) {
|
||||||
|
|
||||||
|
if (isset($row['tournament']['uniqueTournament'])) {
|
||||||
|
$tournament = $row['tournament']['uniqueTournament'];
|
||||||
|
} else {
|
||||||
|
$tournament = $row['tournament'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$category = $tournament['category'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CATEGORY
|
||||||
|
*/
|
||||||
|
$country_id = Country::where('name', $category['name'])->value('id');
|
||||||
|
$call = SofaScoreCategorie::updateOrCreate([
|
||||||
|
'id' => (int) $category['id'],
|
||||||
|
'country_id' => (int) $country_id,
|
||||||
|
'slug' => $category['slug'],
|
||||||
|
], [
|
||||||
|
'name' => $category['name'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TOURNAMENT
|
||||||
|
*/
|
||||||
|
$sofa_score_categorie_id = $call->id;
|
||||||
|
SofaScoreTournament::updateOrCreate([
|
||||||
|
'id' => (int) $tournament['id'],
|
||||||
|
'day' => $day,
|
||||||
|
], [
|
||||||
|
'sport_id' => (int) $sport->id,
|
||||||
|
'sofa_score_categorie_id' => (int) $sofa_score_categorie_id,
|
||||||
|
'name' => $tournament['name'],
|
||||||
|
'slug' => $tournament['slug'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Notice::note('All day grapped', 'g', 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,38 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Console\Commands\Grapper\Sportscore;
|
namespace App\Console\Commands\Grapper\Sofascore;
|
||||||
|
|
||||||
class Helper
|
class Helper
|
||||||
{
|
{
|
||||||
// football
|
public static function map() {}
|
||||||
// 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,159 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands\Grapper\Sofascore;
|
||||||
|
|
||||||
|
use App\Console\Commands\Curl;
|
||||||
|
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;
|
||||||
|
use App\Utilities\Notice;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
|
class Tournament
|
||||||
|
{
|
||||||
|
public static $auth_header = [];
|
||||||
|
|
||||||
|
public static $base_url = '';
|
||||||
|
|
||||||
|
public static $sport = [1];
|
||||||
|
|
||||||
|
public static function load()
|
||||||
|
{
|
||||||
|
$debug = Nuh::$options['d'] ?? 0;
|
||||||
|
|
||||||
|
$YEAR_GO_BACK = date('Y') - 5;
|
||||||
|
|
||||||
|
$sport_id = Nuh::$options['sport_id'];
|
||||||
|
|
||||||
|
$slug = Sport::where('id', $sport_id)->value('ss_slug');
|
||||||
|
|
||||||
|
$dates = Carbon::now();
|
||||||
|
|
||||||
|
while ($dates >= Carbon::now()->subYears($YEAR_GO_BACK)) {
|
||||||
|
|
||||||
|
$tournaments_counter = 0;
|
||||||
|
|
||||||
|
$day = $dates->format('Y-m-d');
|
||||||
|
|
||||||
|
Notice::note('sport: '.Nuh::$options['sport'].' day: '.$day, 'p');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* grap only one time/sport check
|
||||||
|
*/
|
||||||
|
if (! SofaScoreDay::where('day', $day)->where($slug, 1)->first()) {
|
||||||
|
|
||||||
|
SofaScoreDay::updateOrCreate(['day' => $day], [$slug => 1]);
|
||||||
|
|
||||||
|
$page = 1;
|
||||||
|
|
||||||
|
while ($page) {
|
||||||
|
$url = Nuh::$options['base_url']."api/v1/sport/$slug/scheduled-tournaments/$day/page/$page";
|
||||||
|
|
||||||
|
$rand = rand(1000000, 2000000);
|
||||||
|
if ($debug) {
|
||||||
|
Notice::note("Sleep $rand msec", 'g');
|
||||||
|
}
|
||||||
|
usleep($rand);
|
||||||
|
|
||||||
|
$data = Curl::load($url);
|
||||||
|
|
||||||
|
if ($data['hasNextPage']) {
|
||||||
|
$page++;
|
||||||
|
} else {
|
||||||
|
$page = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($data['scheduled'] as $row) {
|
||||||
|
|
||||||
|
if (isset($row['tournament']['uniqueTournament'])) {
|
||||||
|
$tournament = $row['tournament']['uniqueTournament'];
|
||||||
|
} else {
|
||||||
|
$tournament = $row['tournament'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$category = $tournament['category'];
|
||||||
|
|
||||||
|
if ($sport_id == 5) {
|
||||||
|
$country_id = 470;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CATEGORY
|
||||||
|
*/
|
||||||
|
$find = [
|
||||||
|
'Amateur',
|
||||||
|
'Bosnia & Herzegovina',
|
||||||
|
'Czechia',
|
||||||
|
'DR Congo',
|
||||||
|
'Netherlands',
|
||||||
|
'North & Central America',
|
||||||
|
'Bonaire',
|
||||||
|
'Sao Tome and Principe',
|
||||||
|
'Cape Verde',
|
||||||
|
'Macao',
|
||||||
|
];
|
||||||
|
$replace = [
|
||||||
|
'',
|
||||||
|
'Bosnia Herzegovina',
|
||||||
|
'Czech Republic',
|
||||||
|
'Congo DR',
|
||||||
|
'Holland',
|
||||||
|
'North America',
|
||||||
|
'Bonaire, Sint Eustatius and Saba',
|
||||||
|
'Sao Tome e Principe',
|
||||||
|
'Cape Verde Islands',
|
||||||
|
'Macau',
|
||||||
|
];
|
||||||
|
$country_id = Country::where('name', trim(str_replace($find, $replace, $category['name'])))->value('id');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $country_id) {
|
||||||
|
// platzhalter fix later sofa_score_categories => txodds countries
|
||||||
|
// CATEGORY find <-> replace
|
||||||
|
$sofa_score_categorie_id = 10000000;
|
||||||
|
} else {
|
||||||
|
$call = SofaScoreCategorie::updateOrCreate([
|
||||||
|
'id' => (int) $category['id'],
|
||||||
|
'country_id' => (int) $country_id,
|
||||||
|
'slug' => $category['slug'],
|
||||||
|
], [
|
||||||
|
'name' => $category['name'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$sofa_score_categorie_id = $call->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TOURNAMENT
|
||||||
|
*/
|
||||||
|
SofaScoreTournament::updateOrCreate([
|
||||||
|
'sport_id' => (int) $sport_id,
|
||||||
|
'tournament_id' => (int) $tournament['id'],
|
||||||
|
'sofa_score_categorie_id' => (int) $sofa_score_categorie_id,
|
||||||
|
], [
|
||||||
|
'name' => $tournament['name'],
|
||||||
|
'slug' => $tournament['slug'],
|
||||||
|
]);
|
||||||
|
$tournaments_counter++;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DAY TOURNAMENT
|
||||||
|
*/
|
||||||
|
SofaScoreDayTournament::updateOrCreate([
|
||||||
|
'tournament_id' => (int) $tournament['id'],
|
||||||
|
'day' => $day,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Notice::note("tournaments: $tournaments_counter", 'p');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$dates->subDay();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -98,6 +98,11 @@ class SupervisorsTable
|
|||||||
'LOGIFUTURE NIGERA' => 'LOGIFUTURE NIGERA',
|
'LOGIFUTURE NIGERA' => 'LOGIFUTURE NIGERA',
|
||||||
'LOGIFUTURE COLOMBIA' => 'LOGIFUTURE COLOMBIA',
|
'LOGIFUTURE COLOMBIA' => 'LOGIFUTURE COLOMBIA',
|
||||||
];
|
];
|
||||||
|
case 12:
|
||||||
|
return [
|
||||||
|
'TOURNAMENTS' => 'TOURNAMENTS',
|
||||||
|
'EVENTS' => 'EVENTS',
|
||||||
|
];
|
||||||
default:
|
default:
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\SofaScoreTournamentResource;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateSofaScoreTournament extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = SofaScoreTournamentResource::class;
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\SofaScoreTournamentResource;
|
||||||
|
use Filament\Actions\DeleteAction;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditSofaScoreTournament extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = SofaScoreTournamentResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\SofaScoreTournamentResource;
|
||||||
|
use Filament\Actions\CreateAction;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListSofaScoreTournaments extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = SofaScoreTournamentResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScores\Schemas;
|
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Schemas;
|
||||||
|
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
|
|
||||||
class SofaScoreForm
|
class SofaScoreTournamentForm
|
||||||
{
|
{
|
||||||
public static function configure(Schema $schema): Schema
|
public static function configure(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
+62
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments;
|
||||||
|
|
||||||
|
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;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use Livewire\Livewire;
|
||||||
|
use UnitEnum;
|
||||||
|
|
||||||
|
class SofaScoreTournamentResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = SofaScoreTournament::class;
|
||||||
|
|
||||||
|
protected static string|UnitEnum|null $navigationGroup = 'SofaScore';
|
||||||
|
|
||||||
|
protected static ?string $cluster = StaticDataCluster::class;
|
||||||
|
|
||||||
|
protected static ?string $recordTitleAttribute = 'Tournaments';
|
||||||
|
|
||||||
|
protected static ?string $navigationLabel = 'Tournaments';
|
||||||
|
|
||||||
|
public static function form(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return SofaScoreTournamentForm::configure($schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return SofaScoreTournamentsTable::configure($table);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNavigationBadge(): ?string
|
||||||
|
{
|
||||||
|
// return parent::getEloquentQuery()->count();
|
||||||
|
// Ensure we are on the list page
|
||||||
|
if (! class_exists(Livewire::class) || Livewire::current() === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$livewire = Livewire::current();
|
||||||
|
|
||||||
|
// Check if the current component has the table filtering traits
|
||||||
|
if (method_exists($livewire, 'getFilteredTableQuery')) {
|
||||||
|
return (string) $livewire->getFilteredTableQuery()->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => ListSofaScoreTournaments::route('/'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
+129
@@ -0,0 +1,129 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTournaments\Tables;
|
||||||
|
|
||||||
|
use App\Models\SofaScoreCategorie;
|
||||||
|
use App\Models\SofaScoreTournament;
|
||||||
|
use App\Models\Sport;
|
||||||
|
use Filament\Actions\BulkAction;
|
||||||
|
use Filament\Actions\BulkActionGroup;
|
||||||
|
use Filament\Actions\DeleteBulkAction;
|
||||||
|
use Filament\Actions\EditAction;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Schemas\Components\Utilities\Get;
|
||||||
|
use Filament\Support\Enums\IconSize;
|
||||||
|
use Filament\Tables\Columns\CheckboxColumn;
|
||||||
|
use Filament\Tables\Columns\IconColumn;
|
||||||
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Tables\Enums\FiltersLayout;
|
||||||
|
use Filament\Tables\Filters\Filter;
|
||||||
|
use Filament\Tables\Filters\TernaryFilter;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
|
||||||
|
class SofaScoreTournamentsTable
|
||||||
|
{
|
||||||
|
public static function configure(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
IconColumn::make('sport.icon')
|
||||||
|
->label('')
|
||||||
|
->grow(false)
|
||||||
|
->width(30)
|
||||||
|
->color(fn ($record) => $record->sport->color)
|
||||||
|
->icon(fn ($record) => $record->sport->icon)
|
||||||
|
->size(IconSize::Medium)
|
||||||
|
->tooltip(fn ($record) => $record->id)
|
||||||
|
->visibleFrom('lg'),
|
||||||
|
TextColumn::make('sport.name'),
|
||||||
|
TextColumn::make('sofascore_category.name')
|
||||||
|
->icon(fn ($record) => $record->sofascore_category->country->icon),
|
||||||
|
TextColumn::make('name')->searchable(),
|
||||||
|
CheckboxColumn::make('grap'),
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
Filter::make('filters')
|
||||||
|
->columns(2)->columnSpan(2)
|
||||||
|
->schema([
|
||||||
|
Select::make('sport_id')
|
||||||
|
->default(1)
|
||||||
|
->selectablePlaceholder(false)
|
||||||
|
->label('Sport')
|
||||||
|
->options(Sport::where('is_active', 1)->pluck('name', 'id'))
|
||||||
|
->afterStateUpdated(function (callable $set) {
|
||||||
|
$set('sofa_score_categorie_id', null);
|
||||||
|
})
|
||||||
|
->live(),
|
||||||
|
Select::make('sofa_score_categorie_id')
|
||||||
|
->searchable()
|
||||||
|
->multiple()
|
||||||
|
->label('Categorie')
|
||||||
|
->options(function (Get $get) {
|
||||||
|
$res = SofaScoreTournament::where('sport_id', $get('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('competition_group_id')
|
||||||
|
// ->searchable()
|
||||||
|
// ->label('Competition Group')
|
||||||
|
// ->options(function (Get $get) {
|
||||||
|
// if ($get('country_id')) {
|
||||||
|
// return CompetitionGroup::where('country_id', $get('country_id'))->orderBy('name')->pluck('name', 'id');
|
||||||
|
// } else {
|
||||||
|
// return CompetitionGroup::orderBy('name')->pluck('name', 'id');
|
||||||
|
// }
|
||||||
|
// }),
|
||||||
|
])
|
||||||
|
->query(function (Builder $query, array $data): Builder {
|
||||||
|
return $query->when(
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
TernaryFilter::make('grap')->placeholder('All')->label('Grapping'),
|
||||||
|
], layout: FiltersLayout::AboveContent)
|
||||||
|
->deferFilters(false)
|
||||||
|
->recordActions([
|
||||||
|
// EditAction::make(),
|
||||||
|
])
|
||||||
|
->toolbarActions([
|
||||||
|
BulkActionGroup::make([
|
||||||
|
// DeleteBulkAction::make(),
|
||||||
|
BulkAction::make('Grap On')
|
||||||
|
->icon('phosphor-play')
|
||||||
|
->action(function (Collection $records): void {
|
||||||
|
foreach ($records as $record) {
|
||||||
|
SofaScoreTournament::where('id', '=', $record->id)
|
||||||
|
->update(
|
||||||
|
['grap' => 1]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
BulkAction::make('Grap Off')
|
||||||
|
->icon('phosphor-stop')
|
||||||
|
->action(function (Collection $records): void {
|
||||||
|
foreach ($records as $record) {
|
||||||
|
SofaScoreTournament::where('id', '=', $record->id)
|
||||||
|
->update(
|
||||||
|
['grap' => 0]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?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;
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?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(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<?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'),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
<?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('/'),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
<?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(),
|
|
||||||
]),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,6 +9,7 @@ use Filament\Resources\Resource;
|
|||||||
use Filament\Support\Enums\IconSize;
|
use Filament\Support\Enums\IconSize;
|
||||||
use Filament\Tables\Columns\IconColumn;
|
use Filament\Tables\Columns\IconColumn;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Tables\Columns\TextInputColumn;
|
||||||
use Filament\Tables\Columns\ToggleColumn;
|
use Filament\Tables\Columns\ToggleColumn;
|
||||||
use Filament\Tables\Filters\TernaryFilter;
|
use Filament\Tables\Filters\TernaryFilter;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
@@ -42,6 +43,11 @@ class SportResource extends Resource
|
|||||||
TextColumn::make('b365')->alignCenter()->label('Bet365'),
|
TextColumn::make('b365')->alignCenter()->label('Bet365'),
|
||||||
TextColumn::make('logi')->alignCenter()->label('Logifuture'),
|
TextColumn::make('logi')->alignCenter()->label('Logifuture'),
|
||||||
TextColumn::make('magl')->alignCenter()->label('Magloo'),
|
TextColumn::make('magl')->alignCenter()->label('Magloo'),
|
||||||
|
TextInputColumn::make('ss_grap_years')
|
||||||
|
->rules(['required', 'numeric', 'min:1', 'max:20'])
|
||||||
|
->width('1rem')
|
||||||
|
->alignCenter()
|
||||||
|
->label('Grap Years SS'),
|
||||||
ToggleColumn::make('is_active'),
|
ToggleColumn::make('is_active'),
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class SofaScoreCategorie extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'slug',
|
||||||
|
'country_id',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function country()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Country::class, 'country_id', 'id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class SofaScoreDay extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'id',
|
||||||
|
'day',
|
||||||
|
'football',
|
||||||
|
'basketball',
|
||||||
|
'tennis',
|
||||||
|
'ice-hockey',
|
||||||
|
'handball',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class SofaScoreDayTournament extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'id',
|
||||||
|
'tournament_id',
|
||||||
|
'day',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function tournament()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(SofaScoreTournament::class, 'tournament_id', 'tournament_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class SofaScoreEvent extends Model
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class SofaScoreTournament extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'id',
|
||||||
|
'sport_id',
|
||||||
|
'tournament_id',
|
||||||
|
'sofa_score_categorie_id',
|
||||||
|
'name',
|
||||||
|
'slug',
|
||||||
|
'grap',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function sport()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Sport::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sofascore_category()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(SofaScoreCategorie::class, 'sofa_score_categorie_id', 'id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,10 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
|
|
||||||
class Sport extends Model
|
class Sport extends Model
|
||||||
{
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'ss_grap_years',
|
||||||
|
];
|
||||||
|
|
||||||
public static function map(string $field, $reverse = false, $limit = [])
|
public static function map(string $field, $reverse = false, $limit = [])
|
||||||
{
|
{
|
||||||
if (! in_array($field, ['bapi', 'bwin', 'b365', 'logi', 'magl', 'sofascore'])) {
|
if (! in_array($field, ['bapi', 'bwin', 'b365', 'logi', 'magl', 'sofascore'])) {
|
||||||
|
|||||||
Generated
+20
-20
@@ -2960,16 +2960,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/framework",
|
"name": "laravel/framework",
|
||||||
"version": "v12.61.0",
|
"version": "v12.61.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/laravel/framework.git",
|
"url": "https://github.com/laravel/framework.git",
|
||||||
"reference": "1124062a1ca92d290c8bcb9b7f649920fa6816bf"
|
"reference": "e8472ca9774452fe50841d9bdced060679f4d58d"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/laravel/framework/zipball/1124062a1ca92d290c8bcb9b7f649920fa6816bf",
|
"url": "https://api.github.com/repos/laravel/framework/zipball/e8472ca9774452fe50841d9bdced060679f4d58d",
|
||||||
"reference": "1124062a1ca92d290c8bcb9b7f649920fa6816bf",
|
"reference": "e8472ca9774452fe50841d9bdced060679f4d58d",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3178,7 +3178,7 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"source": "https://github.com/laravel/framework"
|
||||||
},
|
},
|
||||||
"time": "2026-05-26T23:41:33+00:00"
|
"time": "2026-06-04T14:22:52+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/prompts",
|
"name": "laravel/prompts",
|
||||||
@@ -9809,16 +9809,16 @@
|
|||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
{
|
{
|
||||||
"name": "barryvdh/laravel-debugbar",
|
"name": "barryvdh/laravel-debugbar",
|
||||||
"version": "v4.2.8",
|
"version": "v4.3.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/fruitcake/laravel-debugbar.git",
|
"url": "https://github.com/fruitcake/laravel-debugbar.git",
|
||||||
"reference": "799d70c1101d3f8840dd76ff68ff6a78f9352905"
|
"reference": "3d76ea8d78b82225b92789de65fc630c1cd8e80c"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/fruitcake/laravel-debugbar/zipball/799d70c1101d3f8840dd76ff68ff6a78f9352905",
|
"url": "https://api.github.com/repos/fruitcake/laravel-debugbar/zipball/3d76ea8d78b82225b92789de65fc630c1cd8e80c",
|
||||||
"reference": "799d70c1101d3f8840dd76ff68ff6a78f9352905",
|
"reference": "3d76ea8d78b82225b92789de65fc630c1cd8e80c",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -9892,7 +9892,7 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/fruitcake/laravel-debugbar/issues",
|
"issues": "https://github.com/fruitcake/laravel-debugbar/issues",
|
||||||
"source": "https://github.com/fruitcake/laravel-debugbar/tree/v4.2.8"
|
"source": "https://github.com/fruitcake/laravel-debugbar/tree/v4.3.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -9904,7 +9904,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2026-04-20T13:31:29+00:00"
|
"time": "2026-06-04T07:54:01+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "brianium/paratest",
|
"name": "brianium/paratest",
|
||||||
@@ -10543,16 +10543,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/sail",
|
"name": "laravel/sail",
|
||||||
"version": "v1.61.0",
|
"version": "v1.62.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/laravel/sail.git",
|
"url": "https://github.com/laravel/sail.git",
|
||||||
"reference": "68ef35015630fe510432e63e11e21749006df688"
|
"reference": "3aaeefc979f8ba6586fbc5b6e0b1b3638058f98e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/laravel/sail/zipball/68ef35015630fe510432e63e11e21749006df688",
|
"url": "https://api.github.com/repos/laravel/sail/zipball/3aaeefc979f8ba6586fbc5b6e0b1b3638058f98e",
|
||||||
"reference": "68ef35015630fe510432e63e11e21749006df688",
|
"reference": "3aaeefc979f8ba6586fbc5b6e0b1b3638058f98e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -10602,7 +10602,7 @@
|
|||||||
"issues": "https://github.com/laravel/sail/issues",
|
"issues": "https://github.com/laravel/sail/issues",
|
||||||
"source": "https://github.com/laravel/sail"
|
"source": "https://github.com/laravel/sail"
|
||||||
},
|
},
|
||||||
"time": "2026-05-23T23:33:57+00:00"
|
"time": "2026-05-27T04:02:01+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "mockery/mockery",
|
"name": "mockery/mockery",
|
||||||
@@ -11752,11 +11752,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan/phpstan",
|
"name": "phpstan/phpstan",
|
||||||
"version": "2.2.1",
|
"version": "2.2.2",
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/dea9c8f2d25cc849391042b71e429c1a4bf82660",
|
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/e5cc34d491a90e79c216d824f60fe21fd4d93bd6",
|
||||||
"reference": "dea9c8f2d25cc849391042b71e429c1a4bf82660",
|
"reference": "e5cc34d491a90e79c216d824f60fe21fd4d93bd6",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -11812,7 +11812,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2026-05-28T14:44:12+00:00"
|
"time": "2026-06-05T09:00:01+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-code-coverage",
|
"name": "phpunit/php-code-coverage",
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
use MongoDB\Laravel\Schema\Blueprint;
|
|
||||||
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
protected $connection = 'mongodb';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
Schema::create('sofascore_events', function (Blueprint $collection) {
|
|
||||||
$collection->index('match_id');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('sofascore_events');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('sofa_score_tournaments', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->integer('sport_id')->index()->references('id')->on('sports');
|
||||||
|
$table->integer('tournament_id')->index();
|
||||||
|
$table->integer('sofa_score_categorie_id')->index();
|
||||||
|
$table->string('slug')->index();
|
||||||
|
$table->string('name');
|
||||||
|
$table->boolean('grap')->index()->default(0);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('sofa_score_tournaments');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('sofa_score_days', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->date('day')->index();
|
||||||
|
$table->boolean('football')->default(0);
|
||||||
|
$table->boolean('basketball')->default(0);
|
||||||
|
$table->boolean('tennis')->default(0);
|
||||||
|
$table->boolean('ice-hockey')->default(0);
|
||||||
|
$table->boolean('handball')->default(0);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('sofa_score_days');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('sofa_score_categories', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('slug')->index();
|
||||||
|
$table->integer('country_id')->nullable()->index();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('sofa_score_categories');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('sofa_score_day_tournaments', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->integer('tournament_id')->index();
|
||||||
|
$table->date('day')->index();
|
||||||
|
$table->boolean('grapped')->index()->default(0);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('sofa_score_day_tournaments');
|
||||||
|
}
|
||||||
|
};
|
||||||
+1638
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user