51 lines
1.8 KiB
PHP
51 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Clusters\User\Resources\Clients\Tables;
|
|
|
|
use App\Actions\SettingGeneratorClient;
|
|
use App\Models\Bookmaker;
|
|
use App\Models\Provider;
|
|
use App\Models\Sport;
|
|
use Filament\Actions\Action;
|
|
use Filament\Actions\EditAction;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Columns\ToggleColumn;
|
|
use Filament\Tables\Table;
|
|
|
|
class ClientsTable
|
|
{
|
|
public static function configure(Table $table): Table
|
|
{
|
|
return $table
|
|
->striped()
|
|
->recordAction(null)
|
|
->columns([
|
|
TextColumn::make('name'),
|
|
TextColumn::make('bookmaker')
|
|
->wrap()
|
|
->badge()
|
|
->formatStateUsing(fn(string $state): string => Bookmaker::where('id', $state)->pluck('name')->first()),
|
|
TextColumn::make('provider')
|
|
->badge()
|
|
->wrap()
|
|
->color('success')
|
|
->formatStateUsing(fn(string $state): string => Provider::where('id', $state)->pluck('name')->first()),
|
|
TextColumn::make('sport')
|
|
->badge()
|
|
->wrap()
|
|
->color('warning')
|
|
->formatStateUsing(fn(string $state): string => Sport::where('id', $state)->pluck('name')->first()),
|
|
ToggleColumn::make('is_active')
|
|
])
|
|
->recordActions([
|
|
Action::make('Create Settings')
|
|
->icon('phosphor-gear-fine')
|
|
->tooltip('Generates basic configuration for client')
|
|
->action(function ($record) {
|
|
SettingGeneratorClient::run($record);
|
|
}),
|
|
EditAction::make()->hiddenLabel(),
|
|
]);
|
|
}
|
|
}
|