wip grapper tournaments
This commit is contained in:
1 parent
acf74c5e82
commit
06c014fa1b
9 files changed
+165
-42
No files matched your search
+13
-3
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreRosas\Tables;
|
||||
|
||||
use App\Models\SofaScoreRosaTournament;
|
||||
use App\Models\SofaScoreTournament;
|
||||
use App\Models\Sport;
|
||||
use Filament\Forms\Components\Select;
|
||||
@@ -17,10 +18,11 @@ class SofaScoreRosasTable
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultPaginationPageOption(50)
|
||||
->columns([
|
||||
TextColumn::make('ssteam_id')->label('SSId')->badge()->width('1rem'),
|
||||
TextColumn::make('country.name')->label('Country'),
|
||||
TextColumn::make('tournament.name')->label('Tournament'),
|
||||
TextColumn::make('tournament_rosa.tournament.name')->label('Tournament'),
|
||||
TextColumn::make('ssteam_name')->label('Name'),
|
||||
TextColumn::make('updated_at')->dateTime('Y-m-d H:i:s')
|
||||
])
|
||||
@@ -38,13 +40,17 @@ class SofaScoreRosasTable
|
||||
})
|
||||
->live(),
|
||||
Select::make('ss_tournament_id')
|
||||
->default(23)
|
||||
->label('Tournament')
|
||||
->selectablePlaceholder(false)
|
||||
->options(function (Get $get) {
|
||||
$res = SofaScoreTournament::with('sofascore_category')->where('enabled', 1)->where('sport_id', $get('sport_id'))->get();
|
||||
$return = [];
|
||||
foreach ($res as $value) {
|
||||
$return[$value->tournament_id] = $value->sofascore_category->name . ' ' . $value->name;
|
||||
$return[$value->tournament_id] = $value->sofascore_category->name . ' - ' . $value->name;
|
||||
}
|
||||
asort($return);
|
||||
|
||||
return $return;
|
||||
})
|
||||
->live(),
|
||||
@@ -55,7 +61,11 @@ class SofaScoreRosasTable
|
||||
fn(Builder $query, $sport_id) => $query->where('sport_id', $sport_id)
|
||||
)->when(
|
||||
$data['ss_tournament_id'],
|
||||
fn(Builder $query, $ss_tournament_id) => $query->where('ss_tournament_id', $ss_tournament_id)
|
||||
function (Builder $query, $ss_tournament_id) {
|
||||
$ssteam_ids = SofaScoreRosaTournament::where('ss_tournament_id', $ss_tournament_id)->pluck('ssteam_id')->toArray();
|
||||
|
||||
$query->whereIn('ssteam_id', $ssteam_ids);
|
||||
}
|
||||
);
|
||||
}),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
|
||||
Reference in new issue
Block a user