From 57a2d75b5713a5703cd9d2b9d3256ddeba5eeadc Mon Sep 17 00:00:00 2001 From: salam Date: Fri, 20 Feb 2026 13:08:22 +0100 Subject: [PATCH] wip --- app/Livewire/ClientGroupListEditor.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Livewire/ClientGroupListEditor.php b/app/Livewire/ClientGroupListEditor.php index ecc245a6..01d1ffeb 100644 --- a/app/Livewire/ClientGroupListEditor.php +++ b/app/Livewire/ClientGroupListEditor.php @@ -4,6 +4,7 @@ namespace App\Livewire; use App\Models\ClientGroupList; use App\Models\CompetitionGroup; +use App\Models\Sport; use Filament\Actions\Concerns\InteractsWithActions; use Filament\Actions\Contracts\HasActions; use Filament\Actions\CreateAction; @@ -29,7 +30,7 @@ class ClientGroupListEditor extends Component implements HasActions, HasSchemas, public function table(Table $table): Table { return $table - ->query(ClientGroupList::query()) + ->query(ClientGroupList::query()->where('sport_id', auth()->user()->sport_id)) ->columns([ TextColumn::make('name'), TextColumn::make('client_groups') @@ -43,7 +44,7 @@ class ClientGroupListEditor extends Component implements HasActions, HasSchemas, return $res->country?->name.' '.$res->name; }), ]) - ->emptyStateHeading('No Custom Groups') + ->emptyStateHeading('No Custom Group for '.Sport::where('id', auth()->user()->sport_id)->value('name')) ->emptyStateDescription('Create a group add one league and save, then you can add more league to this group.') ->recordActions([ EditAction::make('edit') @@ -64,7 +65,7 @@ class ClientGroupListEditor extends Component implements HasActions, HasSchemas, ->preload() ->searchable() ->options(function (): array { - $res = CompetitionGroup::with('country')->get(); + $res = CompetitionGroup::with('country')->where('sport_id', auth()->user()->sport_id)->orderBy('name')->get(); $arr = []; foreach ($res as $value) { $arr[$value->id] = $value->country?->name.' '.$value->name; @@ -88,7 +89,7 @@ class ClientGroupListEditor extends Component implements HasActions, HasSchemas, ->label('League') ->searchable() ->options(function (): array { - $res = CompetitionGroup::with('country')->get(); + $res = CompetitionGroup::with('country')->where('sport_id', auth()->user()->sport_id)->get(); $arr = []; foreach ($res as $value) { $arr[$value->id] = $value->country?->name.' '.$value->name;