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\ClientGroupList;
|
||||||
use App\Models\CompetitionGroup;
|
use App\Models\CompetitionGroup;
|
||||||
|
use App\Models\Sport;
|
||||||
use Filament\Actions\Concerns\InteractsWithActions;
|
use Filament\Actions\Concerns\InteractsWithActions;
|
||||||
use Filament\Actions\Contracts\HasActions;
|
use Filament\Actions\Contracts\HasActions;
|
||||||
use Filament\Actions\CreateAction;
|
use Filament\Actions\CreateAction;
|
||||||
@@ -29,7 +30,7 @@ class ClientGroupListEditor extends Component implements HasActions, HasSchemas,
|
|||||||
public function table(Table $table): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
->query(ClientGroupList::query())
|
->query(ClientGroupList::query()->where('sport_id', auth()->user()->sport_id))
|
||||||
->columns([
|
->columns([
|
||||||
TextColumn::make('name'),
|
TextColumn::make('name'),
|
||||||
TextColumn::make('client_groups')
|
TextColumn::make('client_groups')
|
||||||
@@ -43,7 +44,7 @@ class ClientGroupListEditor extends Component implements HasActions, HasSchemas,
|
|||||||
return $res->country?->name.' '.$res->name;
|
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.')
|
->emptyStateDescription('Create a group add one league and save, then you can add more league to this group.')
|
||||||
->recordActions([
|
->recordActions([
|
||||||
EditAction::make('edit')
|
EditAction::make('edit')
|
||||||
@@ -64,7 +65,7 @@ class ClientGroupListEditor extends Component implements HasActions, HasSchemas,
|
|||||||
->preload()
|
->preload()
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(function (): array {
|
->options(function (): array {
|
||||||
$res = CompetitionGroup::with('country')->get();
|
$res = CompetitionGroup::with('country')->where('sport_id', auth()->user()->sport_id)->orderBy('name')->get();
|
||||||
$arr = [];
|
$arr = [];
|
||||||
foreach ($res as $value) {
|
foreach ($res as $value) {
|
||||||
$arr[$value->id] = $value->country?->name.' '.$value->name;
|
$arr[$value->id] = $value->country?->name.' '.$value->name;
|
||||||
@@ -88,7 +89,7 @@ class ClientGroupListEditor extends Component implements HasActions, HasSchemas,
|
|||||||
->label('League')
|
->label('League')
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(function (): array {
|
->options(function (): array {
|
||||||
$res = CompetitionGroup::with('country')->get();
|
$res = CompetitionGroup::with('country')->where('sport_id', auth()->user()->sport_id)->get();
|
||||||
$arr = [];
|
$arr = [];
|
||||||
foreach ($res as $value) {
|
foreach ($res as $value) {
|
||||||
$arr[$value->id] = $value->country?->name.' '.$value->name;
|
$arr[$value->id] = $value->country?->name.' '.$value->name;
|
||||||
|
|||||||
Reference in new issue
Block a user