Update HostingSubscriptionResource.php

This commit is contained in:
Bozhidar 2024-04-30 11:49:12 +03:00
parent f929f007dd
commit 1099285224

View file

@ -3,6 +3,7 @@
namespace App\Filament\Resources; namespace App\Filament\Resources;
use App\Filament\Resources\HostingSubscriptionResource\Pages; use App\Filament\Resources\HostingSubscriptionResource\Pages;
use App\Models\Customer;
use App\Models\Domain; use App\Models\Domain;
use App\Models\HostingSubscription; use App\Models\HostingSubscription;
use App\Models\PhyreServer; use App\Models\PhyreServer;
@ -150,7 +151,19 @@ class HostingSubscriptionResource extends Resource
]) ])
->defaultSort('id', 'desc') ->defaultSort('id', 'desc')
->filters([ ->filters([
// Tables\Filters\SelectFilter::make('domain')
->attribute('id')
->label('Domain')
->searchable()
->options(fn (): array => HostingSubscription::query()->pluck('domain', 'id')->all()),
Tables\Filters\SelectFilter::make('customer_id')
->searchable()
->options(fn (): array => Customer::query()->pluck('name', 'id')->all()),
Tables\Filters\SelectFilter::make('system_username')
->attribute('id')
->label('System Username')
->searchable()
->options(fn (): array => HostingSubscription::query()->pluck('system_username', 'id')->all())
]) ])
->actions([ ->actions([
Tables\Actions\Action::make('visit') Tables\Actions\Action::make('visit')
@ -199,7 +212,7 @@ class HostingSubscriptionResource extends Resource
public static function getGloballySearchableAttributes(): array public static function getGloballySearchableAttributes(): array
{ {
return ['domain', 'customer.name']; return ['domain', 'system_username', 'customer.name'];
} }
public static function getGlobalSearchResultDetails(Model $record): array public static function getGlobalSearchResultDetails(Model $record): array