From 0fb83969d6533e10082413afa3d6b0d00ffd5242 Mon Sep 17 00:00:00 2001 From: Atila Silva Date: Thu, 8 Jun 2023 17:08:07 -0300 Subject: [PATCH] Update FirewallIpResource.php Fix soft deletes scope --- src/Filament/Resources/FirewallIpResource.php | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Filament/Resources/FirewallIpResource.php b/src/Filament/Resources/FirewallIpResource.php index ff55af3..a88b68c 100644 --- a/src/Filament/Resources/FirewallIpResource.php +++ b/src/Filament/Resources/FirewallIpResource.php @@ -7,6 +7,8 @@ use Filament\Resources\Resource; use Filament\Resources\Table; use Filament\Tables; +use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Support\Facades\Request; use Illuminate\Support\Str; use SolutionForest\FilamentFirewall\Filament\Resources\FirewallIpResource\Pages; @@ -22,14 +24,13 @@ public static function form(Form $form): Form ->default(fn () => Request::getClientIp()) ->regex('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\z/') ->validationAttribute(Str::upper(__('filament-firewall::filament-firewall.form.field.ip'))) - ->suffixAction(fn (callable $set) => - Forms\Components\Actions\Action::make('fillMyIp') - ->label(__('filament-firewall::filament-firewall.action.fillMyIp')) - ->icon('heroicon-o-pencil-alt') - ->action(fn () => $set('ip', Request::getClientIp())) + ->suffixAction(fn (callable $set) => Forms\Components\Actions\Action::make('fillMyIp') + ->label(__('filament-firewall::filament-firewall.action.fillMyIp')) + ->icon('heroicon-o-pencil-alt') + ->action(fn () => $set('ip', Request::getClientIp())) ) ->required(), - + Forms\Components\TextInput::make('prefix_size') ->label(__('filament-firewall::filament-firewall.form.field.prefix_size')) ->numeric() @@ -133,4 +134,12 @@ protected static function getNavigationGroup(): ?string { return __('filament-firewall::filament-firewall.filament.resource.ip.getNavigationGroup'); } + + public static function getEloquentQuery(): Builder + { + return parent::getEloquentQuery() + ->withoutGlobalScopes([ + SoftDeletingScope::class, + ]); + } }