Skip to content

Commit

Permalink
Update FirewallIpResource.php
Browse files Browse the repository at this point in the history
Fix soft deletes scope
  • Loading branch information
a21ns1g4ts authored Jun 8, 2023
1 parent 9b1188f commit 0fb8396
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/Filament/Resources/FirewallIpResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()
Expand Down Expand Up @@ -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,
]);
}
}

0 comments on commit 0fb8396

Please sign in to comment.