diff --git a/app/Console/Commands/Grapper/Sofascore/Tournament.php b/app/Console/Commands/Grapper/Sofascore/Tournament.php index eff12e39..4a585b61 100644 --- a/app/Console/Commands/Grapper/Sofascore/Tournament.php +++ b/app/Console/Commands/Grapper/Sofascore/Tournament.php @@ -181,7 +181,7 @@ class Tournament Notice::note("tournaments: $tournaments_counter", 'p'); } - SofaScoreDay::updateOrCreate(['day' => $day], [$sport->ss_slug => 1]); + SofaScoreDay::updateOrCreate(['day' => $day], ['sport_id' => $sport->id]); } } else { if ($debug) { diff --git a/app/Filament/Clusters/StaticData/Resources/SofaScoreDayTournaments/Pages/CreateSofaScoreDayTournament.php b/app/Filament/Clusters/StaticData/Resources/SofaScoreDayTournaments/Pages/CreateSofaScoreDayTournament.php new file mode 100644 index 00000000..90a4bfdb --- /dev/null +++ b/app/Filament/Clusters/StaticData/Resources/SofaScoreDayTournaments/Pages/CreateSofaScoreDayTournament.php @@ -0,0 +1,11 @@ +components([ + // + ]); + } +} diff --git a/app/Filament/Clusters/StaticData/Resources/SofaScoreDayTournaments/SofaScoreDayTournamentResource.php b/app/Filament/Clusters/StaticData/Resources/SofaScoreDayTournaments/SofaScoreDayTournamentResource.php new file mode 100644 index 00000000..78c25284 --- /dev/null +++ b/app/Filament/Clusters/StaticData/Resources/SofaScoreDayTournaments/SofaScoreDayTournamentResource.php @@ -0,0 +1,66 @@ + ListSofaScoreDayTournaments::route('/'), + ]; + } + + 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; + } +} diff --git a/app/Filament/Clusters/StaticData/Resources/SofaScoreDayTournaments/Tables/SofaScoreDayTournamentsTable.php b/app/Filament/Clusters/StaticData/Resources/SofaScoreDayTournaments/Tables/SofaScoreDayTournamentsTable.php new file mode 100644 index 00000000..9ede172d --- /dev/null +++ b/app/Filament/Clusters/StaticData/Resources/SofaScoreDayTournaments/Tables/SofaScoreDayTournamentsTable.php @@ -0,0 +1,30 @@ +columns([ + // + ]) + ->filters([ + // + ]) + ->recordActions([ + EditAction::make(), + ]) + ->toolbarActions([ + BulkActionGroup::make([ + DeleteBulkAction::make(), + ]), + ]); + } +} diff --git a/app/Filament/Clusters/StaticData/Resources/SofaScoreDays/Tables/SofaScoreDaysTable.php b/app/Filament/Clusters/StaticData/Resources/SofaScoreDays/Tables/SofaScoreDaysTable.php index aab4b26c..dea23abe 100644 --- a/app/Filament/Clusters/StaticData/Resources/SofaScoreDays/Tables/SofaScoreDaysTable.php +++ b/app/Filament/Clusters/StaticData/Resources/SofaScoreDays/Tables/SofaScoreDaysTable.php @@ -2,82 +2,72 @@ namespace App\Filament\Clusters\StaticData\Resources\SofaScoreDays\Tables; +use App\Models\SofaScoreDay; +use App\Models\Sport; +use Filament\Actions\Action; use Filament\Actions\BulkActionGroup; use Filament\Actions\DeleteBulkAction; use Filament\Actions\EditAction; -use Filament\Forms\Components\DatePicker; use Filament\Forms\Components\Select; -use Filament\Tables\Columns\CheckboxColumn; +use Filament\Forms\Components\Toggle; +use Filament\Tables\Columns\IconColumn; 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\Support\Carbon; class SofaScoreDaysTable { public static function configure(Table $table): Table { return $table - ->description('Sport checked is grapped, uncheck to grap data for specivic day again.') + ->description('For days checked events active in tournaments will be grapped.') + ->headerActions([ + Action::make('reset')->icon('phosphor-power')->action(fn() => SofaScoreDay::query()->update(['football' => 0])), + ]) ->columns([ TextColumn::make('day')->sortable(), - CheckboxColumn::make('football'), - CheckboxColumn::make('basketball'), - CheckboxColumn::make('ice-hockey'), - CheckboxColumn::make('tennis'), + TextColumn::make('sport.name'), + ToggleColumn::make('enabled'), ]) ->filters([ Filter::make('day') - ->columns(3)->columnSpan(3) + ->columns(4)->columnSpan(4) ->schema([ - DatePicker::make('from')->native(), - DatePicker::make('until')->native(), - Select::make('sports-grapper') - ->options([ - '1' => 'Soccer Grapped', - '2' => 'Soccer Not Grapped', - '3' => 'Basketball Grapped', - '4' => 'Basketball Not Grapped', - '5' => 'Ice-Hockey Grapped', - '6' => 'Ice-Hockey Not Grapped', - '7' => 'Tennis Grapped', - '8' => 'Tennis Not Grapped', - ]), + 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['from'], - fn(Builder $query, $date): Builder => $query->whereDate('day', '>=', $date), - ) - ->when( - $data['until'], - fn(Builder $query, $date): Builder => $query->whereDate('day', '<=', $date), - )->when( - $data['sports-grapper'], - function (Builder $query, $sports_grapper) { - switch ($sports_grapper) { - case 1: - return $query->where('football', 1); - case 2: - return $query->where('football', 0); - case 3: - return $query->where('basketball', 1); - case 4: - return $query->where('basketball', 0); - case 5: - return $query->where('ice-hockey', 1); - case 6: - return $query->where('ice-hockey', 0); - case 7: - return $query->where('tennis', 1); - case 8: - return $query->where('tennis', 0); - } - } - ); - }), + 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) ->deferFilters(false) ->recordActions([ @@ -85,8 +75,22 @@ class SofaScoreDaysTable ]) ->toolbarActions([ BulkActionGroup::make([ - DeleteBulkAction::make(), + // DeleteBulkAction::make(), ]), ]); } + + 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; + } } diff --git a/app/Filament/Clusters/StaticData/Resources/SofaScoreTournaments/SofaScoreTournamentResource.php b/app/Filament/Clusters/StaticData/Resources/SofaScoreTournaments/SofaScoreTournamentResource.php index 5a0b5841..259b5de6 100644 --- a/app/Filament/Clusters/StaticData/Resources/SofaScoreTournaments/SofaScoreTournamentResource.php +++ b/app/Filament/Clusters/StaticData/Resources/SofaScoreTournaments/SofaScoreTournamentResource.php @@ -25,6 +25,7 @@ class SofaScoreTournamentResource extends Resource protected static ?string $navigationLabel = 'Tournaments'; + public static function form(Schema $schema): Schema { return SofaScoreTournamentForm::configure($schema); diff --git a/app/Filament/Clusters/StaticData/Resources/SofaScoreTournaments/Tables/SofaScoreTournamentsTable.php b/app/Filament/Clusters/StaticData/Resources/SofaScoreTournaments/Tables/SofaScoreTournamentsTable.php index 76a32542..77ee5867 100644 --- a/app/Filament/Clusters/StaticData/Resources/SofaScoreTournaments/Tables/SofaScoreTournamentsTable.php +++ b/app/Filament/Clusters/StaticData/Resources/SofaScoreTournaments/Tables/SofaScoreTournamentsTable.php @@ -6,13 +6,13 @@ 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\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\Columns\ToggleColumn; @@ -28,6 +28,32 @@ class SofaScoreTournamentsTable public static function configure(Table $table): Table { return $table + ->headerActions([ + Action::make('soccer') + ->icon('phosphor-power') + ->requiresConfirmation() + ->modalDescription('This will disable all leagues for soccer') + ->action(fn() => SofaScoreTournament::where('sport_id', 1)->update(['enabled' => 0]) + ), + Action::make('ice-hockey') + ->icon('phosphor-power') + ->requiresConfirmation() + ->modalDescription('This will disable all leagues for ice hockey') + ->action(fn() => SofaScoreTournament::where('sport_id', 2)->update(['enabled' => 0]) + ), + Action::make('basketball') + ->icon('phosphor-power') + ->requiresConfirmation() + ->modalDescription('This will disable all leagues for basketball') + ->action(fn() => SofaScoreTournament::where('sport_id', 3)->update(['enabled' => 0]) + ), + Action::make('tennis') + ->icon('phosphor-power') + ->requiresConfirmation() + ->modalDescription('This will disable all leagues for tennis') + ->action(fn() => SofaScoreTournament::where('sport_id', 5)->update(['enabled' => 0]) + ), + ]) ->poll() ->columns([ IconColumn::make('sport.icon') @@ -39,13 +65,12 @@ class SofaScoreTournamentsTable ->size(IconSize::Medium) ->tooltip(fn($record) => $record->id) ->visibleFrom('lg'), - TextColumn::make('tournament_id'), + TextColumn::make('tournament_id')->sortable(), TextColumn::make('sport.name'), TextColumn::make('sofascore_category.name') ->icon(fn($record) => $record->sofascore_category->country->icon), TextColumn::make('name')->searchable()->sortable(), - ToggleColumn::make('grap')->tooltip('When active liga will be grapped'), - ToggleColumn::make('grapped')->onColor('success')->tooltip('When active liga has been grapped, to grap again disactivate'), + ToggleColumn::make('enabled'), ]) ->filters([ Filter::make('filters') @@ -96,28 +121,30 @@ class SofaScoreTournamentsTable } ); }), - TernaryFilter::make('grap')->placeholder('All')->label('Grapping'), + TernaryFilter::make('enabled')->placeholder('All'), ], layout: FiltersLayout::AboveContent) ->deferFilters(false) ->toolbarActions([ BulkActionGroup::make([ - BulkAction::make('Grap On') - ->icon('phosphor-play') + BulkAction::make('Enable') + ->icon('phosphor-toggle-right-fill') + ->color('primary') ->action(function (Collection $records): void { foreach ($records as $record) { SofaScoreTournament::where('id', '=', $record->id) ->update( - ['grap' => 1] + ['enabled' => 1] ); } }), - BulkAction::make('Grap Off') - ->icon('phosphor-stop') + BulkAction::make('Disable') + ->icon('phosphor-toggle-left-fill') + ->color('gray') ->action(function (Collection $records): void { foreach ($records as $record) { SofaScoreTournament::where('id', '=', $record->id) ->update( - ['grap' => 0] + ['enabled' => 0] ); } }), diff --git a/app/Models/SofaScoreDay.php b/app/Models/SofaScoreDay.php index 33730fb4..61e95286 100644 --- a/app/Models/SofaScoreDay.php +++ b/app/Models/SofaScoreDay.php @@ -9,10 +9,12 @@ class SofaScoreDay extends Model protected $fillable = [ 'id', 'day', - 'football', - 'basketball', - 'tennis', - 'ice-hockey', - 'handball', + 'sport_id', + 'enabled', ]; + + public function sport() + { + return $this->belongsTo(Sport::class, 'sport_id', 'id'); + } } diff --git a/app/Models/SofaScoreTournament.php b/app/Models/SofaScoreTournament.php index 0ead204d..fd3941cb 100644 --- a/app/Models/SofaScoreTournament.php +++ b/app/Models/SofaScoreTournament.php @@ -13,8 +13,7 @@ class SofaScoreTournament extends Model 'sofa_score_categorie_id', 'name', 'slug', - 'grap', - 'grapped', + 'enabled', ]; public function sport() diff --git a/composer.lock b/composer.lock index 6918c443..fd80130e 100644 --- a/composer.lock +++ b/composer.lock @@ -2196,26 +2196,26 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.12.1", + "version": "7.12.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "d34627490fbc03bf5c5d7cfed81f2faa19519425" + "reference": "9aa17bcdd777ee31df9fc83c337ca4ca2340def3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d34627490fbc03bf5c5d7cfed81f2faa19519425", - "reference": "d34627490fbc03bf5c5d7cfed81f2faa19519425", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/9aa17bcdd777ee31df9fc83c337ca4ca2340def3", + "reference": "9aa17bcdd777ee31df9fc83c337ca4ca2340def3", "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/promises": "^2.5", - "guzzlehttp/psr7": "^2.12.1", + "guzzlehttp/psr7": "^2.12.3", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.5 || ^3.0", - "symfony/polyfill-php80": "^1.24" + "symfony/polyfill-php80": "^1.25" }, "provide": { "psr/http-client-implementation": "1.0" @@ -2304,7 +2304,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.12.1" + "source": "https://github.com/guzzle/guzzle/tree/7.12.3" }, "funding": [ { @@ -2320,7 +2320,7 @@ "type": "tidelift" } ], - "time": "2026-06-18T14:12:49+00:00" + "time": "2026-06-23T15:29:02+00:00" }, { "name": "guzzlehttp/promises", @@ -2408,16 +2408,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "2.12.1", + "version": "2.12.3", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "172ef2f4e9824c1e058b7f30be8ae25a02c0f2b7" + "reference": "7ec62dc3f44aa218487dbed81a9bf9bc647be55d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/172ef2f4e9824c1e058b7f30be8ae25a02c0f2b7", - "reference": "172ef2f4e9824c1e058b7f30be8ae25a02c0f2b7", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/7ec62dc3f44aa218487dbed81a9bf9bc647be55d", + "reference": "7ec62dc3f44aa218487dbed81a9bf9bc647be55d", "shasum": "" }, "require": { @@ -2426,7 +2426,7 @@ "psr/http-message": "^1.1 || ^2.0", "ralouphie/getallheaders": "^3.0", "symfony/deprecation-contracts": "^2.5 || ^3.0", - "symfony/polyfill-php80": "^1.24" + "symfony/polyfill-php80": "^1.25" }, "provide": { "psr/http-factory-implementation": "1.0", @@ -2507,7 +2507,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.12.1" + "source": "https://github.com/guzzle/psr7/tree/2.12.3" }, "funding": [ { @@ -2523,25 +2523,25 @@ "type": "tidelift" } ], - "time": "2026-06-18T09:49:37+00:00" + "time": "2026-06-23T15:21:08+00:00" }, { "name": "guzzlehttp/uri-template", - "version": "v1.0.7", + "version": "v1.0.8", "source": { "type": "git", "url": "https://github.com/guzzle/uri-template.git", - "reference": "7fe811c23a9e3cd712b4389eaeb50b5456d8c529" + "reference": "9c19128923b05a5d7355e5d2318d7808b7e33bbd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/uri-template/zipball/7fe811c23a9e3cd712b4389eaeb50b5456d8c529", - "reference": "7fe811c23a9e3cd712b4389eaeb50b5456d8c529", + "url": "https://api.github.com/repos/guzzle/uri-template/zipball/9c19128923b05a5d7355e5d2318d7808b7e33bbd", + "reference": "9c19128923b05a5d7355e5d2318d7808b7e33bbd", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0", - "symfony/polyfill-php80": "^1.24" + "symfony/polyfill-php80": "^1.25" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", @@ -2593,7 +2593,7 @@ ], "support": { "issues": "https://github.com/guzzle/uri-template/issues", - "source": "https://github.com/guzzle/uri-template/tree/v1.0.7" + "source": "https://github.com/guzzle/uri-template/tree/v1.0.8" }, "funding": [ { @@ -2609,7 +2609,7 @@ "type": "tidelift" } ], - "time": "2026-06-12T21:33:43+00:00" + "time": "2026-06-23T13:02:23+00:00" }, { "name": "jaybizzle/crawler-detect", @@ -3576,16 +3576,16 @@ }, { "name": "league/flysystem", - "version": "3.34.0", + "version": "3.35.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "2daaac3b0d4c83ea7ed5d8586e786f5d00f3540e" + "reference": "d0a405f03d980461e4b6e08cfed2c162650f9f6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/2daaac3b0d4c83ea7ed5d8586e786f5d00f3540e", - "reference": "2daaac3b0d4c83ea7ed5d8586e786f5d00f3540e", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/d0a405f03d980461e4b6e08cfed2c162650f9f6b", + "reference": "d0a405f03d980461e4b6e08cfed2c162650f9f6b", "shasum": "" }, "require": { @@ -3653,9 +3653,9 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/3.34.0" + "source": "https://github.com/thephpleague/flysystem/tree/3.35.0" }, - "time": "2026-05-14T10:28:08+00:00" + "time": "2026-06-22T20:12:06+00:00" }, { "name": "league/flysystem-local", @@ -4106,16 +4106,16 @@ }, { "name": "masterminds/html5", - "version": "2.10.0", + "version": "2.10.1", "source": { "type": "git", "url": "https://github.com/Masterminds/html5-php.git", - "reference": "fcf91eb64359852f00d921887b219479b4f21251" + "reference": "fd5018f6815fff903946d0564977b44ce8010e29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/fcf91eb64359852f00d921887b219479b4f21251", - "reference": "fcf91eb64359852f00d921887b219479b4f21251", + "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/fd5018f6815fff903946d0564977b44ce8010e29", + "reference": "fd5018f6815fff903946d0564977b44ce8010e29", "shasum": "" }, "require": { @@ -4123,7 +4123,7 @@ "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9" + "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9 || ^10" }, "type": "library", "extra": { @@ -4167,9 +4167,9 @@ ], "support": { "issues": "https://github.com/Masterminds/html5-php/issues", - "source": "https://github.com/Masterminds/html5-php/tree/2.10.0" + "source": "https://github.com/Masterminds/html5-php/tree/2.10.1" }, - "time": "2025-07-25T09:04:22+00:00" + "time": "2026-06-23T18:43:15+00:00" }, { "name": "maxmind-db/reader", @@ -10468,16 +10468,16 @@ }, { "name": "laravel/sail", - "version": "v1.62.0", + "version": "v1.63.0", "source": { "type": "git", "url": "https://github.com/laravel/sail.git", - "reference": "3aaeefc979f8ba6586fbc5b6e0b1b3638058f98e" + "reference": "51bbce3f803c1d386cabbb44e618c955a12ff5fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/sail/zipball/3aaeefc979f8ba6586fbc5b6e0b1b3638058f98e", - "reference": "3aaeefc979f8ba6586fbc5b6e0b1b3638058f98e", + "url": "https://api.github.com/repos/laravel/sail/zipball/51bbce3f803c1d386cabbb44e618c955a12ff5fc", + "reference": "51bbce3f803c1d386cabbb44e618c955a12ff5fc", "shasum": "" }, "require": { @@ -10527,7 +10527,7 @@ "issues": "https://github.com/laravel/sail/issues", "source": "https://github.com/laravel/sail" }, - "time": "2026-05-27T04:02:01+00:00" + "time": "2026-06-18T08:54:14+00:00" }, { "name": "mockery/mockery", diff --git a/database/migrations/2026_06_06_134913_create_sofa_score_tournaments_table.php b/database/migrations/2026_06_06_134913_create_sofa_score_tournaments_table.php index 9ba5b3c4..7b88dac3 100644 --- a/database/migrations/2026_06_06_134913_create_sofa_score_tournaments_table.php +++ b/database/migrations/2026_06_06_134913_create_sofa_score_tournaments_table.php @@ -18,8 +18,7 @@ return new class extends Migration $table->integer('sofa_score_categorie_id')->index(); $table->string('slug')->index(); $table->string('name'); - $table->boolean('grap')->index()->default(0); - $table->boolean('grapped')->index()->default(0); + $table->boolean('enabled')->index()->default(0); $table->timestamps(); }); } diff --git a/database/migrations/2026_06_06_134919_create_sofa_score_days_table.php b/database/migrations/2026_06_06_134919_create_sofa_score_days_table.php index 7e8de05f..21fc36e3 100644 --- a/database/migrations/2026_06_06_134919_create_sofa_score_days_table.php +++ b/database/migrations/2026_06_06_134919_create_sofa_score_days_table.php @@ -14,11 +14,8 @@ return new class extends Migration 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->integer('sport_id')->index()->references('id')->on('sports'); + $table->boolean('enabled')->index()->default(0); $table->timestamps(); }); }