wip
This commit is contained in:
1 parent
a46a200495
commit
57a2d75b57
1 file changed
+5
-4
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user