Add Owner Filter to ListServers (#1180)

* Add `Owner` Filter to `ListServers`

* Make `Owner` filter show on `other` & `all` tabs

Co-authored-by: Boy132 <Boy132@users.noreply.github.com>

---------

Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
This commit is contained in:
MartinOscar 2025-03-28 12:27:51 +01:00 committed by GitHub
parent 72b9c309d3
commit db3b16e609
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -45,9 +45,19 @@ class ListServers extends ListRecords
->relationship('egg', 'name', fn (Builder $query) => $query->whereIn('id', $baseQuery->pluck('egg_id')))
->searchable()
->preload(),
SelectFilter::make('owner')
->relationship('user', 'username', fn (Builder $query) => $query->whereIn('id', $baseQuery->pluck('owner_id')))
->searchable()
->hidden(fn () => $this->activeTab === 'my')
->preload(),
]);
}
public function updatedActiveTab(): void
{
$this->resetTable();
}
public function getTabs(): array
{
$all = auth()->user()->accessibleServers();