double players
This commit is contained in:
1 parent
fd7b8fadad
commit
11189ec3d6
3 files changed
+19
-22
No files matched your search
+3
-3
@@ -16,9 +16,9 @@ class ListStatistikoEvents extends ListRecords
|
|||||||
protected function getHeaderActions(): array
|
protected function getHeaderActions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Action::make('download')
|
// Action::make('download')
|
||||||
->icon('phosphor-download')
|
// ->icon('phosphor-download')
|
||||||
->color('gray'),
|
// ->color('gray'),
|
||||||
Action::make('truncate')
|
Action::make('truncate')
|
||||||
->icon('phosphor-trash')
|
->icon('phosphor-trash')
|
||||||
->requiresConfirmation()
|
->requiresConfirmation()
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ class StatistikoPlayerForm
|
|||||||
->components([
|
->components([
|
||||||
Grid::make([
|
Grid::make([
|
||||||
'default' => 2,
|
'default' => 2,
|
||||||
'xl' => 4,
|
'xl' => 5,
|
||||||
])->schema([
|
])->schema([
|
||||||
TextInput::make('sport_id'),
|
TextInput::make('sport_id'),
|
||||||
TextInput::make('match_id'),
|
TextInput::make('match_id'),
|
||||||
|
|||||||
+15
-18
@@ -4,6 +4,7 @@ namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Tables;
|
|||||||
|
|
||||||
use App\Models\StatistikoPlayer;
|
use App\Models\StatistikoPlayer;
|
||||||
use Filament\Actions\BulkActionGroup;
|
use Filament\Actions\BulkActionGroup;
|
||||||
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Actions\DeleteBulkAction;
|
use Filament\Actions\DeleteBulkAction;
|
||||||
use Filament\Actions\EditAction;
|
use Filament\Actions\EditAction;
|
||||||
use Filament\Forms\Components\Checkbox;
|
use Filament\Forms\Components\Checkbox;
|
||||||
@@ -18,7 +19,6 @@ class StatistikoPlayersTable
|
|||||||
public static function configure(Table $table): Table
|
public static function configure(Table $table): Table
|
||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
// ->poll()
|
|
||||||
->columns([
|
->columns([
|
||||||
TextColumn::make('match_id')->searchable(),
|
TextColumn::make('match_id')->searchable(),
|
||||||
TextColumn::make('details.name')
|
TextColumn::make('details.name')
|
||||||
@@ -31,28 +31,24 @@ class StatistikoPlayersTable
|
|||||||
TextColumn::make('event.away.name')->searchable()->color('success'),
|
TextColumn::make('event.away.name')->searchable()->color('success'),
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
Filter::make('event_filters')
|
Filter::make('player_filters')
|
||||||
->schema([
|
->schema([
|
||||||
Checkbox::make('find_double'),
|
Checkbox::make('find_double'),
|
||||||
])->query(function (Builder $query, array $data): Builder {
|
])->query(function (Builder $query, array $data): Builder {
|
||||||
return $query->when(
|
return $query->when(
|
||||||
$data['find_double'],
|
$data['find_double'],
|
||||||
function (Builder $query) use ($data) {
|
function (Builder $query) {
|
||||||
$arr = [];
|
$arr = [];
|
||||||
// $events = StatistikoPlayer::query()->select('match_id', 'ss_player_id')->get()->toArray();
|
$events = StatistikoPlayer::query()->select('match_id', 'ss_player_id')->get()->toArray();
|
||||||
// foreach ($events as $value) {
|
foreach ($events as $value) {
|
||||||
// $match_id = $value['match_id'];
|
$match_id = $value['match_id'];
|
||||||
// $ss_player_id = $value['ss_player_id'];
|
$player_id = $value['ss_player_id'];
|
||||||
// if (in_array($ss_player_id, $arr[$value['match_id']]))
|
|
||||||
// $arr[$value['match_id']][] = $value['ss_player_id'];
|
if (isset($arr[$match_id]) && in_array($player_id, $arr[$match_id])) {
|
||||||
// }
|
return $query->where('match_id', $match_id)->where('ss_player_id', $player_id);
|
||||||
// dd($arr);
|
}
|
||||||
// dd($events);
|
$arr[$match_id][] = $player_id;
|
||||||
// $doublEvents = array_diff_assoc(
|
}
|
||||||
// $events,
|
|
||||||
// array_unique($events)
|
|
||||||
// );
|
|
||||||
// $query->whereIn('match_id', $doublEvents)->orderBy('match_id');
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
})->indicateUsing(function (array $data): ?string {
|
})->indicateUsing(function (array $data): ?string {
|
||||||
@@ -65,7 +61,8 @@ class StatistikoPlayersTable
|
|||||||
], layout: FiltersLayout::AboveContent)
|
], layout: FiltersLayout::AboveContent)
|
||||||
->deferFilters(false)
|
->deferFilters(false)
|
||||||
->recordActions([
|
->recordActions([
|
||||||
EditAction::make(),
|
EditAction::make()->iconButton(),
|
||||||
|
DeleteAction::make()->iconButton(),
|
||||||
])
|
])
|
||||||
->toolbarActions([
|
->toolbarActions([
|
||||||
BulkActionGroup::make([
|
BulkActionGroup::make([
|
||||||
|
|||||||
Reference in new issue
Block a user